1*b1cdbd2cSJim Jagielski<?xml version="1.0" encoding="UTF-8"?> 2*b1cdbd2cSJim Jagielski<helpdocument version="1.0"> 3*b1cdbd2cSJim Jagielski 4*b1cdbd2cSJim Jagielski<!--*********************************************************** 5*b1cdbd2cSJim Jagielski * 6*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 7*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 8*b1cdbd2cSJim Jagielski * distributed with this work for additional information 9*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 10*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 11*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 12*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 13*b1cdbd2cSJim Jagielski * 14*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 15*b1cdbd2cSJim Jagielski * 16*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 17*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 18*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 19*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 20*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 21*b1cdbd2cSJim Jagielski * under the License. 22*b1cdbd2cSJim Jagielski * 23*b1cdbd2cSJim Jagielski ***********************************************************--> 24*b1cdbd2cSJim Jagielski 25*b1cdbd2cSJim Jagielski 26*b1cdbd2cSJim Jagielski 27*b1cdbd2cSJim Jagielski 28*b1cdbd2cSJim Jagielski<meta> 29*b1cdbd2cSJim Jagielski <topic id="textswriterguideconditional_textxml" indexer="include" status="PUBLISH"> 30*b1cdbd2cSJim Jagielski <title xml-lang="en-US" id="tit">Conditional Text</title> 31*b1cdbd2cSJim Jagielski <filename>/text/swriter/guide/conditional_text.xhp</filename> 32*b1cdbd2cSJim Jagielski </topic> 33*b1cdbd2cSJim Jagielski </meta> 34*b1cdbd2cSJim Jagielski <body> 35*b1cdbd2cSJim Jagielski<bookmark xml-lang="en-US" branch="index" id="bm_id3155619"><bookmark_value>matching conditional text in fields</bookmark_value> 36*b1cdbd2cSJim Jagielski <bookmark_value>if-then queries as fields</bookmark_value> 37*b1cdbd2cSJim Jagielski <bookmark_value>conditional text; setting up</bookmark_value> 38*b1cdbd2cSJim Jagielski <bookmark_value>text; conditional text</bookmark_value> 39*b1cdbd2cSJim Jagielski <bookmark_value>defining;conditions</bookmark_value> 40*b1cdbd2cSJim Jagielski</bookmark> 41*b1cdbd2cSJim Jagielski<paragraph xml-lang="en-US" id="hd_id3155619" role="heading" level="1" l10n="U" oldref="4"><variable id="conditional_text"><link href="text/swriter/guide/conditional_text.xhp" name="Conditional Text">Conditional Text</link> 42*b1cdbd2cSJim Jagielski</variable></paragraph> 43*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="par_id3155879" role="paragraph" l10n="U" oldref="5">You can set up fields in your document that display text when a condition that you define is met. For example, you can define the conditional text that is displayed in a series of reminder letters.</paragraph> 44*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="par_id3155895" role="paragraph" l10n="U" oldref="6">Setting up conditional text in this example is a two-part process. First you create a variable, and then you create the condition.</paragraph> 45*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="hd_id3153175" role="heading" level="2" l10n="U" 46*b1cdbd2cSJim Jagielski oldref="61">To Define a Conditional Variable</paragraph> 47*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="par_id3153185" role="paragraph" l10n="U" oldref="62">The first part of the example is to define a variable for the condition statement. </paragraph> 48*b1cdbd2cSJim Jagielski <list type="ordered"> 49*b1cdbd2cSJim Jagielski <listitem> 50*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="par_id3155566" role="listitem" l10n="U" oldref="8">Choose <item type="menuitem">Insert - Fields - Other</item>, and then click the <item type="menuitem">Variables</item> tab.</paragraph> 51*b1cdbd2cSJim Jagielski </listitem> 52*b1cdbd2cSJim Jagielski <listitem> 53*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="par_id3147759" role="listitem" l10n="U" oldref="9">Click "Set variable" in the <item type="menuitem">Type</item> 54*b1cdbd2cSJim Jagielski <emph/>list.</paragraph> 55*b1cdbd2cSJim Jagielski </listitem> 56*b1cdbd2cSJim Jagielski <listitem> 57*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="par_id3147784" role="listitem" l10n="U" oldref="10">Type a name for the variable in the <item type="menuitem">Name</item> box, for example <item type="literal">Reminder</item>.</paragraph> 58*b1cdbd2cSJim Jagielski </listitem> 59*b1cdbd2cSJim Jagielski <listitem> 60*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="par_id3147810" role="listitem" l10n="U" oldref="57">Click "Text" in the<emph/> 61*b1cdbd2cSJim Jagielski <item type="menuitem">Format</item> list.</paragraph> 62*b1cdbd2cSJim Jagielski </listitem> 63*b1cdbd2cSJim Jagielski <listitem> 64*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="par_id7748344" role="listitem" l10n="NEW">Enter <item type="literal">1</item> in the <item type="menuitem">Value</item> box, and then click <item type="menuitem">Insert</item>.<br/>The Format list now displays a "General" format.</paragraph> 65*b1cdbd2cSJim Jagielski </listitem> 66*b1cdbd2cSJim Jagielski </list> 67*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="hd_id3145645" role="heading" level="2" l10n="U" 68*b1cdbd2cSJim Jagielski oldref="63">To Define a Condition and the Conditional Text</paragraph> 69*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="par_id3145659" role="paragraph" l10n="U" oldref="64">The second part of the example is to define the condition that must be met, and to insert a placeholder for displaying the conditional text in your document.</paragraph> 70*b1cdbd2cSJim Jagielski <list type="ordered"> 71*b1cdbd2cSJim Jagielski <listitem> 72*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="par_id3151193" role="listitem" l10n="U" oldref="12">Place the cursor where you want to insert the conditional text in your text.</paragraph> 73*b1cdbd2cSJim Jagielski </listitem> 74*b1cdbd2cSJim Jagielski <listitem> 75*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="par_id3151212" role="listitem" l10n="U" oldref="65">Choose <item type="menuitem">Insert - Fields - Other</item>, and then click the <item type="menuitem">Functions</item> tab.</paragraph> 76*b1cdbd2cSJim Jagielski </listitem> 77*b1cdbd2cSJim Jagielski <listitem> 78*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="par_id3151250" role="listitem" l10n="U" oldref="13">Click "Conditional text" in the <item type="menuitem">Type</item> 79*b1cdbd2cSJim Jagielski <emph/>list.</paragraph> 80*b1cdbd2cSJim Jagielski </listitem> 81*b1cdbd2cSJim Jagielski <listitem> 82*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="par_id3155936" role="listitem" l10n="U" oldref="14">Type <item type="literal">Reminder EQ "3"</item> in the <item type="menuitem">Condition</item> 83*b1cdbd2cSJim Jagielski <emph/>box. In other words, the conditional text will be displayed when the variable in the field that you defined in the first part of this example is equal to three.</paragraph> 84*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="par_id3155969" role="listitem" l10n="U" oldref="15">The quotation marks enclosing the "3" indicate that the variable that you defined in the first part of this example is a text string.</paragraph> 85*b1cdbd2cSJim Jagielski </listitem> 86*b1cdbd2cSJim Jagielski </list> 87*b1cdbd2cSJim Jagielski <list type="ordered" startwith="5"> 88*b1cdbd2cSJim Jagielski <listitem> 89*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="par_id3150446" role="listitem" l10n="U" oldref="16">Type the text that you want to display when the condition is met in the <emph>Then</emph> box. There is almost no limit to the length of the text that you can enter. You can paste a paragraph into this box.</paragraph> 90*b1cdbd2cSJim Jagielski </listitem> 91*b1cdbd2cSJim Jagielski <listitem> 92*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="par_id3150473" role="listitem" l10n="U" oldref="17">Click <emph>Insert</emph>, and then click <emph>Close</emph>.</paragraph> 93*b1cdbd2cSJim Jagielski </listitem> 94*b1cdbd2cSJim Jagielski </list> 95*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="hd_id3155073" role="heading" level="2" l10n="U" 96*b1cdbd2cSJim Jagielski oldref="66">To Display the Conditional Text</paragraph> 97*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="par_id3155086" role="paragraph" l10n="U" oldref="67">In this example, the conditional text is displayed when the value of the conditional variable is equal to 3.</paragraph> 98*b1cdbd2cSJim Jagielski <list type="ordered"> 99*b1cdbd2cSJim Jagielski <listitem> 100*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="par_id3155110" role="listitem" l10n="U" oldref="19">Place your cursor in front of the field that you defined in the first part of this example, and then choose <emph>Edit - Fields</emph>.</paragraph> 101*b1cdbd2cSJim Jagielski </listitem> 102*b1cdbd2cSJim Jagielski <listitem> 103*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="par_id3155136" role="listitem" l10n="U" oldref="68">Replace the number in the <item type="menuitem">Value</item> 104*b1cdbd2cSJim Jagielski <emph/>box with 3, and then click<emph/> 105*b1cdbd2cSJim Jagielski <item type="menuitem">Close</item>.</paragraph> 106*b1cdbd2cSJim Jagielski </listitem> 107*b1cdbd2cSJim Jagielski <listitem> 108*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="par_id3155168" role="listitem" l10n="U" oldref="20">If the field does not automatically update, press F9.</paragraph> 109*b1cdbd2cSJim Jagielski </listitem> 110*b1cdbd2cSJim Jagielski </list> 111*b1cdbd2cSJim Jagielski <section id="relatedtopics"> 112*b1cdbd2cSJim Jagielski <embed href="text/swriter/guide/fields_userdata.xhp#fields_userdata"/> 113*b1cdbd2cSJim Jagielski <embed href="text/swriter/guide/conditional_text2.xhp#conditional_text2"/> 114*b1cdbd2cSJim Jagielski <embed href="text/swriter/01/04090200.xhp#defining_conditions"/> 115*b1cdbd2cSJim Jagielski <paragraph xml-lang="en-US" id="par_id3145714" role="paragraph" l10n="C"><link href="text/swriter/02/14020000.xhp" name="List of conditional operators">List of conditional operators</link></paragraph> 116*b1cdbd2cSJim Jagielski </section> 117*b1cdbd2cSJim Jagielski </body> 118*b1cdbd2cSJim Jagielski</helpdocument>