1*cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?>
2*cdf0e10cSrcweir<helpdocument version="1.0">
3*cdf0e10cSrcweir
4*cdf0e10cSrcweir<!--
5*cdf0e10cSrcweir***********************************************************************
6*cdf0e10cSrcweir *
7*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8*cdf0e10cSrcweir *
9*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates.
10*cdf0e10cSrcweir *
11*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite
12*cdf0e10cSrcweir *
13*cdf0e10cSrcweir * This file is part of OpenOffice.org.
14*cdf0e10cSrcweir *
15*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify
16*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3
17*cdf0e10cSrcweir * only, as published by the Free Software Foundation.
18*cdf0e10cSrcweir *
19*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful,
20*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of
21*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details
23*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code).
24*cdf0e10cSrcweir *
25*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License
26*cdf0e10cSrcweir * version 3 along with OpenOffice.org.  If not, see
27*cdf0e10cSrcweir * <http://www.openoffice.org/license.html>
28*cdf0e10cSrcweir * for a copy of the LGPLv3 License.
29*cdf0e10cSrcweir *
30*cdf0e10cSrcweir ************************************************************************
31*cdf0e10cSrcweir -->
32*cdf0e10cSrcweir
33*cdf0e10cSrcweir
34*cdf0e10cSrcweir<meta>
35*cdf0e10cSrcweir      <topic id="textswriterguideconditional_textxml" indexer="include" status="PUBLISH">
36*cdf0e10cSrcweir         <title xml-lang="en-US" id="tit">Conditional Text</title>
37*cdf0e10cSrcweir         <filename>/text/swriter/guide/conditional_text.xhp</filename>
38*cdf0e10cSrcweir      </topic>
39*cdf0e10cSrcweir   </meta>
40*cdf0e10cSrcweir   <body>
41*cdf0e10cSrcweir<bookmark xml-lang="en-US" branch="index" id="bm_id3155619"><bookmark_value>matching conditional text in fields</bookmark_value>
42*cdf0e10cSrcweir      <bookmark_value>if-then queries as fields</bookmark_value>
43*cdf0e10cSrcweir      <bookmark_value>conditional text; setting up</bookmark_value>
44*cdf0e10cSrcweir      <bookmark_value>text; conditional text</bookmark_value>
45*cdf0e10cSrcweir      <bookmark_value>defining;conditions</bookmark_value>
46*cdf0e10cSrcweir</bookmark>
47*cdf0e10cSrcweir<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>
48*cdf0e10cSrcweir</variable></paragraph>
49*cdf0e10cSrcweir      <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>
50*cdf0e10cSrcweir      <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>
51*cdf0e10cSrcweir      <paragraph xml-lang="en-US" id="hd_id3153175" role="heading" level="2" l10n="U"
52*cdf0e10cSrcweir                 oldref="61">To Define a Conditional Variable</paragraph>
53*cdf0e10cSrcweir      <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>
54*cdf0e10cSrcweir      <list type="ordered">
55*cdf0e10cSrcweir         <listitem>
56*cdf0e10cSrcweir            <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>
57*cdf0e10cSrcweir         </listitem>
58*cdf0e10cSrcweir         <listitem>
59*cdf0e10cSrcweir            <paragraph xml-lang="en-US" id="par_id3147759" role="listitem" l10n="U" oldref="9">Click "Set variable" in the <item type="menuitem">Type</item>
60*cdf0e10cSrcweir               <emph/>list.</paragraph>
61*cdf0e10cSrcweir         </listitem>
62*cdf0e10cSrcweir         <listitem>
63*cdf0e10cSrcweir            <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>
64*cdf0e10cSrcweir         </listitem>
65*cdf0e10cSrcweir         <listitem>
66*cdf0e10cSrcweir            <paragraph xml-lang="en-US" id="par_id3147810" role="listitem" l10n="U" oldref="57">Click "Text" in the<emph/>
67*cdf0e10cSrcweir               <item type="menuitem">Format</item> list.</paragraph>
68*cdf0e10cSrcweir         </listitem>
69*cdf0e10cSrcweir         <listitem>
70*cdf0e10cSrcweir            <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>
71*cdf0e10cSrcweir         </listitem>
72*cdf0e10cSrcweir      </list>
73*cdf0e10cSrcweir      <paragraph xml-lang="en-US" id="hd_id3145645" role="heading" level="2" l10n="U"
74*cdf0e10cSrcweir                 oldref="63">To Define a Condition and the Conditional Text</paragraph>
75*cdf0e10cSrcweir      <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>
76*cdf0e10cSrcweir      <list type="ordered">
77*cdf0e10cSrcweir         <listitem>
78*cdf0e10cSrcweir            <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>
79*cdf0e10cSrcweir         </listitem>
80*cdf0e10cSrcweir         <listitem>
81*cdf0e10cSrcweir            <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>
82*cdf0e10cSrcweir         </listitem>
83*cdf0e10cSrcweir         <listitem>
84*cdf0e10cSrcweir            <paragraph xml-lang="en-US" id="par_id3151250" role="listitem" l10n="U" oldref="13">Click "Conditional text" in the <item type="menuitem">Type</item>
85*cdf0e10cSrcweir               <emph/>list.</paragraph>
86*cdf0e10cSrcweir         </listitem>
87*cdf0e10cSrcweir         <listitem>
88*cdf0e10cSrcweir            <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>
89*cdf0e10cSrcweir               <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>
90*cdf0e10cSrcweir            <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>
91*cdf0e10cSrcweir         </listitem>
92*cdf0e10cSrcweir      </list>
93*cdf0e10cSrcweir      <list type="ordered" startwith="5">
94*cdf0e10cSrcweir         <listitem>
95*cdf0e10cSrcweir            <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>
96*cdf0e10cSrcweir         </listitem>
97*cdf0e10cSrcweir         <listitem>
98*cdf0e10cSrcweir            <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>
99*cdf0e10cSrcweir         </listitem>
100*cdf0e10cSrcweir      </list>
101*cdf0e10cSrcweir      <paragraph xml-lang="en-US" id="hd_id3155073" role="heading" level="2" l10n="U"
102*cdf0e10cSrcweir                 oldref="66">To Display the Conditional Text</paragraph>
103*cdf0e10cSrcweir      <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>
104*cdf0e10cSrcweir      <list type="ordered">
105*cdf0e10cSrcweir         <listitem>
106*cdf0e10cSrcweir            <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>
107*cdf0e10cSrcweir         </listitem>
108*cdf0e10cSrcweir         <listitem>
109*cdf0e10cSrcweir            <paragraph xml-lang="en-US" id="par_id3155136" role="listitem" l10n="U" oldref="68">Replace the number in the <item type="menuitem">Value</item>
110*cdf0e10cSrcweir               <emph/>box with 3, and then click<emph/>
111*cdf0e10cSrcweir               <item type="menuitem">Close</item>.</paragraph>
112*cdf0e10cSrcweir         </listitem>
113*cdf0e10cSrcweir         <listitem>
114*cdf0e10cSrcweir            <paragraph xml-lang="en-US" id="par_id3155168" role="listitem" l10n="U" oldref="20">If the field does not automatically update, press F9.</paragraph>
115*cdf0e10cSrcweir         </listitem>
116*cdf0e10cSrcweir      </list>
117*cdf0e10cSrcweir      <section id="relatedtopics">
118*cdf0e10cSrcweir         <embed href="text/swriter/guide/fields_userdata.xhp#fields_userdata"/>
119*cdf0e10cSrcweir         <embed href="text/swriter/guide/conditional_text2.xhp#conditional_text2"/>
120*cdf0e10cSrcweir         <embed href="text/swriter/01/04090200.xhp#defining_conditions"/>
121*cdf0e10cSrcweir         <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>
122*cdf0e10cSrcweir      </section>
123*cdf0e10cSrcweir   </body>
124*cdf0e10cSrcweir</helpdocument>