1cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?> 244904c58Smseidel 30e4b25e7SAndrew Rist<!--*********************************************************** 444904c58Smseidel * 50e4b25e7SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 60e4b25e7SAndrew Rist * or more contributor license agreements. See the NOTICE file 70e4b25e7SAndrew Rist * distributed with this work for additional information 80e4b25e7SAndrew Rist * regarding copyright ownership. The ASF licenses this file 90e4b25e7SAndrew Rist * to you under the Apache License, Version 2.0 (the 100e4b25e7SAndrew Rist * "License"); you may not use this file except in compliance 110e4b25e7SAndrew Rist * with the License. You may obtain a copy of the License at 1244904c58Smseidel * 130e4b25e7SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 1444904c58Smseidel * 150e4b25e7SAndrew Rist * Unless required by applicable law or agreed to in writing, 160e4b25e7SAndrew Rist * software distributed under the License is distributed on an 170e4b25e7SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 180e4b25e7SAndrew Rist * KIND, either express or implied. See the License for the 190e4b25e7SAndrew Rist * specific language governing permissions and limitations 200e4b25e7SAndrew Rist * under the License. 2144904c58Smseidel * 220e4b25e7SAndrew Rist ***********************************************************--> 230e4b25e7SAndrew Rist 2444904c58Smseidel<helpdocument version="1.0"> 25cdf0e10cSrcweir<meta> 2644904c58Smseidel<topic id="textswriterguideconditional_textxml" indexer="include" status="PUBLISH"> 2744904c58Smseidel<title xml-lang="en-US" id="tit">Conditional Text</title> 2844904c58Smseidel<filename>/text/swriter/guide/conditional_text.xhp</filename> 2944904c58Smseidel</topic> 3044904c58Smseidel</meta> 3144904c58Smseidel<body> 3244904c58Smseidel<bookmark xml-lang="en-US" branch="index" id="bm_id3155619"> 3344904c58Smseidel<bookmark_value>matching conditional text in fields</bookmark_value> 3444904c58Smseidel<bookmark_value>if-then queries as fields</bookmark_value> 3544904c58Smseidel<bookmark_value>conditional text; setting up</bookmark_value> 3644904c58Smseidel<bookmark_value>text; conditional text</bookmark_value> 3744904c58Smseidel<bookmark_value>defining;conditions</bookmark_value> 38cdf0e10cSrcweir</bookmark> 39cdf0e10cSrcweir<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> 40cdf0e10cSrcweir</variable></paragraph> 4144904c58Smseidel<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> 4244904c58Smseidel<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> 4344904c58Smseidel<paragraph xml-lang="en-US" id="hd_id3153175" role="heading" level="2" l10n="U" 4444904c58Smseideloldref="61">To Define a Conditional Variable</paragraph> 45*36f71006Smseidel<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> 4644904c58Smseidel<list type="ordered"> 4744904c58Smseidel<listitem> 4844904c58Smseidel<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> 4944904c58Smseidel</listitem> 5044904c58Smseidel<listitem> 5144904c58Smseidel<paragraph xml-lang="en-US" id="par_id3147759" role="listitem" l10n="U" oldref="9">Click "Set variable" in the <item type="menuitem">Type</item> list.</paragraph> 5244904c58Smseidel</listitem> 5344904c58Smseidel<listitem> 5444904c58Smseidel<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> 5544904c58Smseidel</listitem> 5644904c58Smseidel<listitem> 5744904c58Smseidel<paragraph xml-lang="en-US" id="par_id3147810" role="listitem" l10n="U" oldref="57">Click "Text" in the <item type="menuitem">Format</item> list.</paragraph> 5844904c58Smseidel</listitem> 5944904c58Smseidel<listitem> 6044904c58Smseidel<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> 6144904c58Smseidel</listitem> 6244904c58Smseidel</list> 6344904c58Smseidel<paragraph xml-lang="en-US" id="hd_id3145645" role="heading" level="2" l10n="U" 6444904c58Smseideloldref="63">To Define a Condition and the Conditional Text</paragraph> 6544904c58Smseidel<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> 6644904c58Smseidel<list type="ordered"> 6744904c58Smseidel<listitem> 6844904c58Smseidel<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> 6944904c58Smseidel</listitem> 7044904c58Smseidel<listitem> 7144904c58Smseidel<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> 7244904c58Smseidel</listitem> 7344904c58Smseidel<listitem> 7444904c58Smseidel<paragraph xml-lang="en-US" id="par_id3151250" role="listitem" l10n="U" oldref="13">Click "Conditional text" in the <item type="menuitem">Type</item> list.</paragraph> 7544904c58Smseidel</listitem> 7644904c58Smseidel<listitem> 7744904c58Smseidel<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> 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> 7844904c58Smseidel<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> 7944904c58Smseidel</listitem> 8044904c58Smseidel</list> 8144904c58Smseidel<list type="ordered" startwith="5"> 8244904c58Smseidel<listitem> 8344904c58Smseidel<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> 8444904c58Smseidel</listitem> 8544904c58Smseidel<listitem> 8644904c58Smseidel<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> 8744904c58Smseidel</listitem> 8844904c58Smseidel</list> 8944904c58Smseidel<paragraph xml-lang="en-US" id="hd_id3155073" role="heading" level="2" l10n="U" 9044904c58Smseideloldref="66">To Display the Conditional Text</paragraph> 9144904c58Smseidel<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> 9244904c58Smseidel<list type="ordered"> 9344904c58Smseidel<listitem> 9444904c58Smseidel<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> 9544904c58Smseidel</listitem> 9644904c58Smseidel<listitem> 9744904c58Smseidel<paragraph xml-lang="en-US" id="par_id3155136" role="listitem" l10n="U" oldref="68">Replace the number in the <item type="menuitem">Value</item> box with 3, and then click <item type="menuitem">Close</item>.</paragraph> 9844904c58Smseidel</listitem> 9944904c58Smseidel<listitem> 10044904c58Smseidel<paragraph xml-lang="en-US" id="par_id3155168" role="listitem" l10n="U" oldref="20">If the field does not automatically update, press F9.</paragraph> 10144904c58Smseidel</listitem> 10244904c58Smseidel</list> 10344904c58Smseidel<section id="relatedtopics"> 10444904c58Smseidel<embed href="text/swriter/guide/fields_userdata.xhp#fields_userdata"/> 10544904c58Smseidel<embed href="text/swriter/guide/conditional_text2.xhp#conditional_text2"/> 10644904c58Smseidel<embed href="text/swriter/01/04090200.xhp#defining_conditions"/> 10744904c58Smseidel<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> 10844904c58Smseidel</section> 10944904c58Smseidel</body> 11044904c58Smseidel</helpdocument> 111