Update ooo320-m1
[ooovba.git] / helpcontent2 / source / text / swriter / 01 / 04090200.xhp
blob66da064bd8e0708df859073d5ee49061a9e1313d
1 <?xml version="1.0" encoding="UTF-8"?>
2 <helpdocument version="1.0">
4 <!--
5 ***********************************************************************
7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 *
9 * Copyright 2008 by Sun Microsystems, Inc.
11 * OpenOffice.org - a multi-platform office productivity suite
13 * $RCSfile: soffice2xmlhelp.xsl,v $
14 * $Revision: 1.8 $
16 * This file is part of OpenOffice.org.
18 * OpenOffice.org is free software: you can redistribute it and/or modify
19 * it under the terms of the GNU Lesser General Public License version 3
20 * only, as published by the Free Software Foundation.
22 * OpenOffice.org is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU Lesser General Public License version 3 for more details
26 * (a copy is included in the LICENSE file that accompanied this code).
28 * You should have received a copy of the GNU Lesser General Public License
29 * version 3 along with OpenOffice.org. If not, see
30 * <http://www.openoffice.org/license.html>
31 * for a copy of the LGPLv3 License.
33 ************************************************************************
34 -->
37 <meta>
38 <topic id="textswriter0104090200xml" indexer="include" status="PUBLISH">
39 <title xml-lang="en-US" id="tit">Defining Conditions</title>
40 <filename>/text/swriter/01/04090200.xhp</filename>
41 </topic>
42 </meta>
43 <body>
44 <bookmark xml-lang="en-US" branch="index" id="bm_id3145828"><bookmark_value>logical expressions</bookmark_value>
45 <bookmark_value>formulating conditions</bookmark_value>
46 <bookmark_value>conditions; in fields and sections</bookmark_value>
47 <bookmark_value>fields;defining conditions</bookmark_value>
48 <bookmark_value>sections;defining conditions</bookmark_value>
49 <bookmark_value>variables; in conditions</bookmark_value>
50 <bookmark_value>user data;in conditions</bookmark_value>
51 <bookmark_value>databases;in conditions</bookmark_value>
52 <bookmark_value>hiding; database fields</bookmark_value>
53 </bookmark>
54 <paragraph xml-lang="en-US" id="hd_id3145828" role="heading" level="1" l10n="CHG"
55 oldref="1"><variable id="defining_conditions"><link href="text/swriter/01/04090200.xhp">Defining Conditions</link>
56 </variable></paragraph>
57 <paragraph xml-lang="en-US" id="par_id3145242" role="paragraph" l10n="CHG" oldref="13">Conditions are logical expressions that you can use to control the display of <link href="text/swriter/01/04090000.xhp">fields</link> and <link href="text/swriter/01/04020000.xhp">sections</link> in your document. Although the following examples apply to fields, they also apply to sections.</paragraph>
58 <paragraph xml-lang="en-US" id="par_id3147171" role="paragraph" l10n="U" oldref="93">You can define conditions for the following field types:</paragraph>
59 <list type="ordered">
60 <listitem>
61 <paragraph xml-lang="en-US" id="par_id3151185" role="listitem" l10n="U" oldref="14">Conditional text: displays text A if the condition is true, or text B if the condition is false.</paragraph>
62 </listitem>
63 <listitem>
64 <paragraph xml-lang="en-US" id="par_id3149289" role="listitem" l10n="U" oldref="15">Hidden text: hides the contents of the field if the condition is true.</paragraph>
65 </listitem>
66 <listitem>
67 <paragraph xml-lang="en-US" id="par_id3145412" role="listitem" l10n="U" oldref="16">Hidden paragraph: hides the paragraph if the condition is true.</paragraph>
68 </listitem>
69 <listitem>
70 <paragraph xml-lang="en-US" id="par_id3147515" role="listitem" l10n="U" oldref="17">Any record and next record: controls the access to database records.</paragraph>
71 </listitem>
72 </list>
73 <paragraph xml-lang="en-US" id="par_id3149802" role="paragraph" l10n="U" oldref="18">The simplest way to define a condition is to type the logical expression directly in a <emph>Condition </emph>box using the following values:</paragraph>
74 <table id="tbl_id3153537">
75 <tablerow>
76 <tablecell>
77 <paragraph xml-lang="en-US" id="par_id3153677" role="paragraph" l10n="CHG" oldref="19">TRUE</paragraph>
78 </tablecell>
79 <tablecell>
80 <paragraph xml-lang="en-US" id="par_id3152960" role="paragraph" l10n="U" oldref="20">The condition is always met. You can also enter any value not equal to 0 as the conditional text.</paragraph>
81 </tablecell>
82 </tablerow>
83 <tablerow>
84 <tablecell>
85 <paragraph xml-lang="en-US" id="par_id3155900" role="paragraph" l10n="CHG" oldref="21">FALSE</paragraph>
86 </tablecell>
87 <tablecell>
88 <paragraph xml-lang="en-US" id="par_id3154191" role="paragraph" l10n="U" oldref="22">The condition is not met. You can also enter the value 0.</paragraph>
89 </tablecell>
90 </tablerow>
91 </table>
93 <paragraph xml-lang="en-US" id="par_id3147090" role="note" l10n="U" oldref="23">If you leave the <emph>Condition </emph>box empty, the condition is interpreted as not being met.</paragraph>
94 <paragraph xml-lang="en-US" id="par_id3148980" role="paragraph" l10n="U" oldref="24">When you define a condition, use the same <link href="text/swriter/02/14020000.xhp">elements</link> for defining a formula, namely comparative operators, mathematical and statistical functions, number formats, variables and constants.</paragraph>
95 <paragraph xml-lang="en-US" id="par_id3153638" role="paragraph" l10n="U" oldref="25">You can use the following types of variables when you define a condition:</paragraph>
96 <list type="ordered">
97 <listitem>
98 <paragraph xml-lang="en-US" id="par_id3155135" role="listitem" l10n="U" oldref="27">Predefined <link href="text/swriter/02/14020000.xhp">$[officename] variables</link> that use statistics on document properties</paragraph>
99 </listitem>
100 <listitem>
101 <paragraph xml-lang="en-US" id="par_id3156273" role="listitem" l10n="U" oldref="26">Custom variables, that are a created with the "Set variable" field</paragraph>
102 </listitem>
103 <listitem>
104 <paragraph xml-lang="en-US" id="par_id3149174" role="listitem" l10n="U" oldref="94">Variables based on user data</paragraph>
105 </listitem>
106 <listitem>
107 <paragraph xml-lang="en-US" id="par_id3145781" role="listitem" l10n="U" oldref="28">Variables based on the contents of database fields</paragraph>
108 </listitem>
109 </list>
110 <paragraph xml-lang="en-US" id="par_id3155916" role="paragraph" l10n="U" oldref="29">You cannot use internal variables, such as page and chapter numbers, in condition expression.</paragraph>
111 <paragraph xml-lang="en-US" id="hd_id3151375" role="heading" level="2" l10n="U"
112 oldref="30">Conditions and Variables</paragraph>
113 <paragraph xml-lang="en-US" id="par_id3150122" role="paragraph" l10n="U" oldref="31">The following examples use a variable called "x":</paragraph>
114 <table id="tbl_id3155867">
115 <tablerow>
116 <tablecell>
117 <paragraph xml-lang="en-US" id="par_id3147417" role="paragraph" l10n="U" oldref="32">x == 1 or x EQ 1</paragraph>
118 </tablecell>
119 <tablecell>
120 <paragraph xml-lang="en-US" id="par_id3147500" role="paragraph" l10n="U" oldref="33">The condition is true if "x" is equal to 1.</paragraph>
121 </tablecell>
122 </tablerow>
123 <tablerow>
124 <tablecell>
125 <paragraph xml-lang="en-US" id="par_id3145259" role="paragraph" l10n="U" oldref="34">x != 1 or x NEQ 1</paragraph>
126 </tablecell>
127 <tablecell>
128 <paragraph xml-lang="en-US" id="par_id3150551" role="paragraph" l10n="U" oldref="35">The condition is true if "x" does not equal 1.</paragraph>
129 </tablecell>
130 </tablerow>
131 <tablerow>
132 <tablecell>
133 <paragraph xml-lang="en-US" id="par_id3147749" role="paragraph" l10n="U" oldref="36">sinx == 0</paragraph>
134 </tablecell>
135 <tablecell>
136 <paragraph xml-lang="en-US" id="par_id3146345" role="paragraph" l10n="U" oldref="37">The condition is true if "x" is a multiple of pi.</paragraph>
137 </tablecell>
138 </tablerow>
139 </table>
141 <paragraph xml-lang="en-US" id="par_id3149846" role="paragraph" l10n="U" oldref="38">To use comparative operators with strings, the operands must be bounded by double quotation marks:</paragraph>
142 <table id="tbl_id3148855">
143 <tablerow>
144 <tablecell>
145 <paragraph xml-lang="en-US" id="par_id3151078" role="paragraph" l10n="U" oldref="39">x == "ABC" or x EQ "ABC"</paragraph>
146 </tablecell>
147 <tablecell>
148 <paragraph xml-lang="en-US" id="par_id3150162" role="paragraph" l10n="U" oldref="40">Checks if variable "x" contains (true) the "ABC" string, or not (false).</paragraph>
149 </tablecell>
150 </tablerow>
151 <tablerow>
152 <tablecell>
153 <paragraph xml-lang="en-US" id="par_id3153301" role="paragraph" l10n="U" oldref="41">x == "" or x EQ ""</paragraph>
154 <paragraph xml-lang="en-US" id="par_id3156120" role="paragraph" l10n="U" oldref="90">or</paragraph>
155 <paragraph xml-lang="en-US" id="par_id3156133" role="paragraph" l10n="U" oldref="42">!x or NOT x</paragraph>
156 </tablecell>
157 <tablecell>
158 <paragraph xml-lang="en-US" id="par_id3156112" role="paragraph" l10n="U" oldref="44">Checks if the variable "x" contains an empty string.</paragraph>
159 </tablecell>
160 </tablerow>
161 </table>
163 <paragraph xml-lang="en-US" id="par_id3150097" role="note" l10n="CHG" oldref="45">The "equal" comparative operator must be represented by two equal signs (==) in a condition. For example, if you define a variable "x" with the value of 1, you can enter the condition as x==1.</paragraph>
164 <paragraph xml-lang="en-US" id="hd_id3148791" role="heading" level="2" l10n="U"
165 oldref="95">User Data</paragraph>
166 <paragraph xml-lang="en-US" id="par_id3150028" role="paragraph" l10n="U" oldref="96">You can include user data when you define conditions. To change your user data, choose <emph>Tools - Options - $[officename] - User data</emph>. User data must be entered in the form of strings. You can query the user data with "==" (EQ), "!=" (NEQ), or "!"(NOT).</paragraph>
167 <paragraph xml-lang="en-US" id="par_id3153124" role="paragraph" l10n="U" oldref="97">The following table lists user data variables and their meanings:</paragraph>
168 <table id="tbl_id3153139">
169 <tablerow>
170 <tablecell>
171 <paragraph xml-lang="en-US" id="par_id3149632" role="paragraph" l10n="U" oldref="130">Variable</paragraph>
172 </tablecell>
173 <tablecell>
174 <paragraph xml-lang="en-US" id="par_id3150662" role="paragraph" l10n="U" oldref="131">Meaning</paragraph>
175 </tablecell>
176 </tablerow>
177 <tablerow>
178 <tablecell>
179 <paragraph xml-lang="en-US" id="par_id3154026" role="paragraph" l10n="U" oldref="98">user_firstname</paragraph>
180 </tablecell>
181 <tablecell>
182 <paragraph xml-lang="en-US" id="par_id3149953" role="paragraph" l10n="U" oldref="99">First name</paragraph>
183 </tablecell>
184 </tablerow>
185 <tablerow>
186 <tablecell>
187 <paragraph xml-lang="en-US" id="par_id3147272" role="paragraph" l10n="U" oldref="100">user_lastname</paragraph>
188 </tablecell>
189 <tablecell>
190 <paragraph xml-lang="en-US" id="par_id3149601" role="paragraph" l10n="U" oldref="101">Last name</paragraph>
191 </tablecell>
192 </tablerow>
193 <tablerow>
194 <tablecell>
195 <paragraph xml-lang="en-US" id="par_id3150770" role="paragraph" l10n="U" oldref="102">user_initials</paragraph>
196 </tablecell>
197 <tablecell>
198 <paragraph xml-lang="en-US" id="par_id3155529" role="paragraph" l10n="U" oldref="103">Initials</paragraph>
199 </tablecell>
200 </tablerow>
201 <tablerow>
202 <tablecell>
203 <paragraph xml-lang="en-US" id="par_id3148705" role="paragraph" l10n="U" oldref="104">user_company</paragraph>
204 </tablecell>
205 <tablecell>
206 <paragraph xml-lang="en-US" id="par_id3148728" role="paragraph" l10n="U" oldref="105">Company</paragraph>
207 </tablecell>
208 </tablerow>
209 <tablerow>
210 <tablecell>
211 <paragraph xml-lang="en-US" id="par_id3155361" role="paragraph" l10n="U" oldref="106">user_street</paragraph>
212 </tablecell>
213 <tablecell>
214 <paragraph xml-lang="en-US" id="par_id3154222" role="paragraph" l10n="U" oldref="107">Street</paragraph>
215 </tablecell>
216 </tablerow>
217 <tablerow>
218 <tablecell>
219 <paragraph xml-lang="en-US" id="par_id3145108" role="paragraph" l10n="U" oldref="108">user_country</paragraph>
220 </tablecell>
221 <tablecell>
222 <paragraph xml-lang="en-US" id="par_id3146885" role="paragraph" l10n="U" oldref="109">Country</paragraph>
223 </tablecell>
224 </tablerow>
225 <tablerow>
226 <tablecell>
227 <paragraph xml-lang="en-US" id="par_id3149580" role="paragraph" l10n="U" oldref="110">user_zipcode</paragraph>
228 </tablecell>
229 <tablecell>
230 <paragraph xml-lang="en-US" id="par_id3156241" role="paragraph" l10n="U" oldref="111">Zip code</paragraph>
231 </tablecell>
232 </tablerow>
233 <tablerow>
234 <tablecell>
235 <paragraph xml-lang="en-US" id="par_id3148922" role="paragraph" l10n="U" oldref="112">user_city</paragraph>
236 </tablecell>
237 <tablecell>
238 <paragraph xml-lang="en-US" id="par_id3148945" role="paragraph" l10n="U" oldref="113">City</paragraph>
239 </tablecell>
240 </tablerow>
241 <tablerow>
242 <tablecell>
243 <paragraph xml-lang="en-US" id="par_id3156053" role="paragraph" l10n="U" oldref="114">user_title</paragraph>
244 </tablecell>
245 <tablecell>
246 <paragraph xml-lang="en-US" id="par_id3159219" role="paragraph" l10n="U" oldref="115">Title</paragraph>
247 </tablecell>
248 </tablerow>
249 <tablerow>
250 <tablecell>
251 <paragraph xml-lang="en-US" id="par_id3156435" role="paragraph" l10n="U" oldref="116">user_position</paragraph>
252 </tablecell>
253 <tablecell>
254 <paragraph xml-lang="en-US" id="par_id3145178" role="paragraph" l10n="U" oldref="117">Position</paragraph>
255 </tablecell>
256 </tablerow>
257 <tablerow>
258 <tablecell>
259 <paragraph xml-lang="en-US" id="par_id3150797" role="paragraph" l10n="U" oldref="118">user_tel_work</paragraph>
260 </tablecell>
261 <tablecell>
262 <paragraph xml-lang="en-US" id="par_id3150820" role="paragraph" l10n="U" oldref="119">Business telephone number</paragraph>
263 </tablecell>
264 </tablerow>
265 <tablerow>
266 <tablecell>
267 <paragraph xml-lang="en-US" id="par_id3150894" role="paragraph" l10n="U" oldref="120">user_tel_home</paragraph>
268 </tablecell>
269 <tablecell>
270 <paragraph xml-lang="en-US" id="par_id3155320" role="paragraph" l10n="U" oldref="121">Home telephone number</paragraph>
271 </tablecell>
272 </tablerow>
273 <tablerow>
274 <tablecell>
275 <paragraph xml-lang="en-US" id="par_id3154400" role="paragraph" l10n="U" oldref="122">user_fax</paragraph>
276 </tablecell>
277 <tablecell>
278 <paragraph xml-lang="en-US" id="par_id3153363" role="paragraph" l10n="U" oldref="123">Fax number</paragraph>
279 </tablecell>
280 </tablerow>
281 <tablerow>
282 <tablecell>
283 <paragraph xml-lang="en-US" id="par_id3153390" role="paragraph" l10n="U" oldref="124">user_email</paragraph>
284 </tablecell>
285 <tablecell>
286 <paragraph xml-lang="en-US" id="par_id3154948" role="paragraph" l10n="U" oldref="125">E-mail address</paragraph>
287 </tablecell>
288 </tablerow>
289 <tablerow>
290 <tablecell>
291 <paragraph xml-lang="en-US" id="par_id3145603" role="paragraph" l10n="U" oldref="126">user_state</paragraph>
292 </tablecell>
293 <tablecell>
294 <paragraph xml-lang="en-US" id="par_id3150129" role="paragraph" l10n="U" oldref="127">State (not in all $[officename] versions)</paragraph>
295 </tablecell>
296 </tablerow>
297 </table>
299 <paragraph xml-lang="en-US" id="par_id3150147" role="paragraph" l10n="U" oldref="128">For example, to hide a paragraph, text, or a section from a user with a specific initial, such as "LM", enter the condition: user_initials=="LM".</paragraph>
300 <paragraph xml-lang="en-US" id="hd_id3154115" role="heading" level="2" l10n="U"
301 oldref="46">Conditions and Database Fields</paragraph>
302 <paragraph xml-lang="en-US" id="par_id3154128" role="paragraph" l10n="U" oldref="47">You can define conditions for accessing databases, or database fields. For example, you can check the contents of a database field from a condition, or use database fields in logical expressions. The following table lists a few more examples of using databases in conditions:</paragraph>
303 <table id="tbl_id3154848">
304 <tablerow>
305 <tablecell>
306 <paragraph xml-lang="en-US" id="par_id3156066" role="paragraph" l10n="U" oldref="132">Example</paragraph>
307 </tablecell>
308 <tablecell>
309 <paragraph xml-lang="en-US" id="par_id3156088" role="paragraph" l10n="U" oldref="133">Meaning</paragraph>
310 </tablecell>
311 </tablerow>
312 <tablerow>
313 <tablecell>
314 <paragraph xml-lang="en-US" id="par_id3155948" role="paragraph" l10n="U" oldref="48">Database.Table.Company</paragraph>
315 <paragraph xml-lang="en-US" id="par_id3148673" role="paragraph" l10n="U" oldref="91">Database.Table.Company NEQ ""</paragraph>
316 <paragraph xml-lang="en-US" id="par_id3148687" role="paragraph" l10n="U" oldref="92">Database.Table.Company != ""</paragraph>
317 </tablecell>
318 <tablecell>
319 <paragraph xml-lang="en-US" id="par_id3155373" role="paragraph" l10n="U" oldref="49">The condition is true if the COMPANY field is not empty. (In the first example, no operator is required.)</paragraph>
320 </tablecell>
321 </tablerow>
322 <tablerow>
323 <tablecell>
324 <paragraph xml-lang="en-US" id="par_id3149977" role="paragraph" l10n="U" oldref="7">!Database.Table.Company</paragraph>
325 <paragraph xml-lang="en-US" id="par_id3149991" role="paragraph" l10n="U" oldref="129">NOT Database.Table.Company</paragraph>
326 <paragraph xml-lang="en-US" id="par_id3150004" role="paragraph" l10n="U" oldref="50">Database.Table.Company EQ ""</paragraph>
327 <paragraph xml-lang="en-US" id="par_id3146911" role="paragraph" l10n="U" oldref="9">Database.Table.Company ==""</paragraph>
328 </tablecell>
329 <tablecell>
330 <paragraph xml-lang="en-US" id="par_id3148733" role="paragraph" l10n="U" oldref="8">Returns TRUE if the COMPANY field is empty. (Exclamation sign represents a logical NOT.)</paragraph>
331 </tablecell>
332 </tablerow>
333 <tablerow>
334 <tablecell>
335 <paragraph xml-lang="en-US" id="par_id3148762" role="paragraph" l10n="U" oldref="5">Database.Table.Company !="Sun Microsystems"</paragraph>
336 <paragraph xml-lang="en-US" id="par_id3153016" role="paragraph" l10n="U" oldref="149">Database.Table.Company NEQ "Sun Microsystems"</paragraph>
337 </tablecell>
338 <tablecell>
339 <paragraph xml-lang="en-US" id="par_id3153040" role="paragraph" l10n="U" oldref="6">Returns TRUE if the current entry in the COMPANY field is "Sun Microsystems".</paragraph>
340 </tablecell>
341 </tablerow>
342 <tablerow>
343 <tablecell>
344 <paragraph xml-lang="en-US" id="par_id3154605" role="paragraph" l10n="U" oldref="51">Database.Table.Firstname AND Database.Table.Name</paragraph>
345 </tablecell>
346 <tablecell>
347 <paragraph xml-lang="en-US" id="par_id3153059" role="paragraph" l10n="U" oldref="52">Returns TRUE if the record contains the first and the last name.</paragraph>
348 </tablecell>
349 </tablerow>
350 </table>
352 <paragraph xml-lang="en-US" id="par_id3159247" role="note" l10n="U" oldref="53">Note the difference between the boolean NOT "!" and the comparative operator not equal "!=" (NEQ).</paragraph>
353 <paragraph xml-lang="en-US" id="par_id3153876" role="paragraph" l10n="CHG" oldref="54">When you refer to a database field in a condition, use the form Databasename.Tablename.Fieldname. If one of the names contains a character that is an operator, such as a minus sign (-), enclose the name in square brackets, for example, Databasename.[Table-name].Fieldname. Never use spaces inside field names.<comment>UFI: fixes bug #i25781# - but see #i25983#. Fixes also #i19571#</comment></paragraph>
354 <paragraph xml-lang="en-US" id="par_id3153891" role="paragraph" l10n="U" oldref="55">Example: Hiding an Empty Database Field</paragraph>
355 <paragraph xml-lang="en-US" id="par_id3150051" role="paragraph" l10n="U" oldref="56">You may want to create a condition that hides an empty field, for example, if the COMPANY field is empty for some of the data records.</paragraph>
356 <paragraph xml-lang="en-US" id="par_id3150067" role="paragraph" l10n="CHG" oldref="57">Select the <emph>Hidden Paragraph</emph> list entry, and type the following condition: Addressbook.Addresses.Company EQ ""</paragraph>
357 <paragraph xml-lang="en-US" id="par_id3147110" role="paragraph" l10n="U" oldref="150">or type the following</paragraph>
358 <paragraph xml-lang="en-US" id="par_id3147123" role="paragraph" l10n="U" oldref="151">NOT Addressbook.Addresses.Company</paragraph>
359 <paragraph xml-lang="en-US" id="par_id3147136" role="paragraph" l10n="U" oldref="152">If the COMPANY database field is empty, the condition is true and the paragraph is hidden.</paragraph>
360 <paragraph xml-lang="en-US" id="par_id3150232" role="note" l10n="CHG" oldref="58">To display hidden paragraphs on the screen, you can choose <emph>Tools - Options - %PRODUCTNAME Writer - Formatting Aids</emph>, and clear the <emph>Fields: Hidden paragraphs</emph> check box.</paragraph>
361 <paragraph xml-lang="en-US" id="hd_id3145218" role="heading" level="2" l10n="U"
362 oldref="59">Examples of Conditions in Fields</paragraph>
363 <paragraph xml-lang="en-US" id="par_id3145231" role="paragraph" l10n="U" oldref="60">The following examples use the Conditional text field, although they can be applied to any fields that can be linked to a condition. The syntax used for conditions is also used for the Hidden text, Hidden paragraph, Any record or Next record fields.</paragraph>
364 <paragraph xml-lang="en-US" id="hd_id3150311" role="heading" level="2" l10n="U"
365 oldref="61">To display conditional text based on the number of pages:</paragraph>
366 <list type="ordered">
367 <listitem>
368 <paragraph xml-lang="en-US" id="par_id3150333" role="listitem" l10n="U" oldref="136">Choose <emph>Insert - Fields - Other</emph>, and then click the <emph>Functions</emph> tab.</paragraph>
369 </listitem>
370 <listitem>
371 <paragraph xml-lang="en-US" id="par_id3147471" role="listitem" l10n="U" oldref="62">In the <emph>Type</emph> list, click "Conditional text".</paragraph>
372 </listitem>
373 <listitem>
374 <paragraph xml-lang="en-US" id="par_id3154294" role="listitem" l10n="U" oldref="63">In the <emph>Condition </emph>box, type "page == 1".</paragraph>
375 </listitem>
376 <listitem>
377 <paragraph xml-lang="en-US" id="par_id3154319" role="listitem" l10n="U" oldref="64">In the <emph>Then</emph> box, type "There is only one page".</paragraph>
378 </listitem>
379 <listitem>
380 <paragraph xml-lang="en-US" id="par_id3150640" role="listitem" l10n="U" oldref="65">In the <emph>Or </emph>box, type "There are several pages".</paragraph>
381 </listitem>
382 <listitem>
383 <paragraph xml-lang="en-US" id="par_id3153086" role="listitem" l10n="U" oldref="137">Click <emph>Insert</emph>, and then click <emph>Close</emph>.</paragraph>
384 </listitem>
385 </list>
386 <paragraph xml-lang="en-US" id="hd_id3155814" role="heading" level="2" l10n="U"
387 oldref="67">To display conditional text based on a user-defined Variable</paragraph>
388 <list type="ordered">
389 <listitem>
390 <paragraph xml-lang="en-US" id="par_id3155836" role="listitem" l10n="U" oldref="138">Choose <emph>Insert - Fields - Other</emph>, and then click the <emph>Variables</emph> tab.</paragraph>
391 </listitem>
392 <listitem>
393 <paragraph xml-lang="en-US" id="par_id3155109" role="listitem" l10n="U" oldref="68">In the <emph>Type </emph>list, click "Set Variable".</paragraph>
394 </listitem>
395 <listitem>
396 <paragraph xml-lang="en-US" id="par_id3147008" role="listitem" l10n="U" oldref="139">In the<emph> Name</emph> box, type "Profit".</paragraph>
397 </listitem>
398 <listitem>
399 <paragraph xml-lang="en-US" id="par_id3147032" role="listitem" l10n="U" oldref="140">In the<emph> Value</emph> box, type "5000".</paragraph>
400 </listitem>
401 <listitem>
402 <paragraph xml-lang="en-US" id="par_id3152974" role="listitem" l10n="U" oldref="141">Click <emph>Insert</emph>.</paragraph>
403 </listitem>
404 <listitem>
405 <paragraph xml-lang="en-US" id="par_id3152998" role="listitem" l10n="U" oldref="70">Click the <emph>Functions</emph> tab, and click "Conditional text" in the <emph>Type</emph> list.</paragraph>
406 </listitem>
407 <listitem>
408 <paragraph xml-lang="en-US" id="par_id3150952" role="listitem" l10n="U" oldref="142">In the <emph>Condition</emph> box, type "Profit &lt; 5000".</paragraph>
409 </listitem>
410 <listitem>
411 <paragraph xml-lang="en-US" id="par_id3156291" role="listitem" l10n="U" oldref="71">In the <emph>Then</emph> box, type "Target is not met".</paragraph>
412 </listitem>
413 <listitem>
414 <paragraph xml-lang="en-US" id="par_id3156317" role="listitem" l10n="U" oldref="72">In the <emph>Or </emph>box, type "Target is met".</paragraph>
415 </listitem>
416 <listitem>
417 <paragraph xml-lang="en-US" id="par_id3154366" role="listitem" l10n="U" oldref="143">Click <emph>Insert</emph>.</paragraph>
418 </listitem>
419 </list>
420 <paragraph xml-lang="en-US" id="par_id3154389" role="paragraph" l10n="U" oldref="73">To edit the contents of the "Profit" variable, double-click the variable field.</paragraph>
421 <paragraph xml-lang="en-US" id="hd_id3155573" role="heading" level="2" l10n="U"
422 oldref="74">To display conditional text based on the contents of a database field:</paragraph>
423 <paragraph xml-lang="en-US" id="par_id3155587" role="paragraph" l10n="CHG" oldref="144">The first part of this example inserts a space between the "First Name" and "Last Name" fields in a document, and the second part inserts text based on the contents of a field. This example requires that an address data source is registered with $[officename].</paragraph>
424 <list type="ordered">
425 <listitem>
426 <paragraph xml-lang="en-US" id="par_id3150523" role="listitem" l10n="U" oldref="145">Choose <emph>Insert - Fields - Other</emph>, and then click the <emph>Database</emph> tab.</paragraph>
427 </listitem>
428 <listitem>
429 <paragraph xml-lang="en-US" id="par_id3148811" role="listitem" l10n="U" oldref="75">In the <emph>Type </emph>list, click "Mail merge fields".</paragraph>
430 </listitem>
431 <listitem>
432 <paragraph xml-lang="en-US" id="par_id3148841" role="listitem" l10n="U" oldref="76">In the<emph> Database selection</emph> box, double-click an address book, click "First Name", and then click<emph> Insert</emph>. Repeat for "Last Name".</paragraph>
433 </listitem>
434 <listitem>
435 <paragraph xml-lang="en-US" id="par_id3147549" role="listitem" l10n="U" oldref="78">In the document, place the cursor between the two fields, press Space, and then return to the <emph>Fields </emph>dialog:</paragraph>
436 </listitem>
437 <listitem>
438 <paragraph xml-lang="en-US" id="par_id3150416" role="listitem" l10n="U" oldref="79">Click the <emph>Functions</emph> tab, and then click "Conditional text" in the <emph>Type</emph> list.</paragraph>
439 </listitem>
440 <listitem>
441 <paragraph xml-lang="en-US" id="par_id3153589" role="listitem" l10n="U" oldref="146">In the <emph>Condition </emph>box, type: "Addressbook.addresses.firstname".</paragraph>
442 </listitem>
443 <listitem>
444 <paragraph xml-lang="en-US" id="par_id3153615" role="listitem" l10n="U" oldref="80">In the <emph>Then </emph>box, type a space and leave the <emph>Or </emph>box blank.</paragraph>
445 </listitem>
446 </list>
447 <paragraph xml-lang="en-US" id="par_id3153562" role="paragraph" l10n="U" oldref="84">You can now use a condition to insert text based on the contents of the First Name field.</paragraph>
448 <list type="ordered">
449 <listitem>
450 <paragraph xml-lang="en-US" id="par_id3150574" role="listitem" l10n="U" oldref="147">In the <emph>Fields </emph>dialog, click the <emph>Functions </emph>tab.</paragraph>
451 </listitem>
452 <listitem>
453 <paragraph xml-lang="en-US" id="par_id3150605" role="listitem" l10n="U" oldref="85">In the <emph>Type </emph>box, click "Conditional text".</paragraph>
454 </listitem>
455 <listitem>
456 <paragraph xml-lang="en-US" id="par_id3151277" role="listitem" l10n="U" oldref="86">In the <emph>Condition </emph>box, type: Addressbook.addresses.firstname == "Michael"</paragraph>
457 </listitem>
458 <listitem>
459 <paragraph xml-lang="en-US" id="par_id3151303" role="listitem" l10n="U" oldref="87">In the <emph>Then </emph>box, type "Dear".</paragraph>
460 </listitem>
461 <listitem>
462 <paragraph xml-lang="en-US" id="par_id3149138" role="listitem" l10n="CHG" oldref="88">In the <emph>Else</emph> box, type "Hello".</paragraph>
463 </listitem>
464 <listitem>
465 <paragraph xml-lang="en-US" id="par_id3149163" role="listitem" l10n="U" oldref="148">Click <emph>Insert</emph>.</paragraph>
466 </listitem>
467 </list>
468 </body>
469 </helpdocument>