1cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?>
2cdf0e10cSrcweir
382a1df74SAndrew Rist<!--***********************************************************
4*c5ffc49bSmseidel *
582a1df74SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
682a1df74SAndrew Rist * or more contributor license agreements.  See the NOTICE file
782a1df74SAndrew Rist * distributed with this work for additional information
882a1df74SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
982a1df74SAndrew Rist * to you under the Apache License, Version 2.0 (the
1082a1df74SAndrew Rist * "License"); you may not use this file except in compliance
1182a1df74SAndrew Rist * with the License.  You may obtain a copy of the License at
12*c5ffc49bSmseidel *
1382a1df74SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
14*c5ffc49bSmseidel *
1582a1df74SAndrew Rist * Unless required by applicable law or agreed to in writing,
1682a1df74SAndrew Rist * software distributed under the License is distributed on an
1782a1df74SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1882a1df74SAndrew Rist * KIND, either express or implied.  See the License for the
1982a1df74SAndrew Rist * specific language governing permissions and limitations
2082a1df74SAndrew Rist * under the License.
21*c5ffc49bSmseidel *
2282a1df74SAndrew Rist ***********************************************************-->
2382a1df74SAndrew Rist
24*c5ffc49bSmseidel<helpdocument version="1.0">
25cdf0e10cSrcweir<meta>
26*c5ffc49bSmseidel<topic id="textswriter0104090200xml" indexer="include" status="PUBLISH">
27*c5ffc49bSmseidel<title xml-lang="en-US" id="tit">Defining Conditions</title>
28*c5ffc49bSmseidel<filename>/text/swriter/01/04090200.xhp</filename>
29*c5ffc49bSmseidel</topic>
30*c5ffc49bSmseidel</meta>
31*c5ffc49bSmseidel<body>
32*c5ffc49bSmseidel<bookmark xml-lang="en-US" branch="index" id="bm_id3145828">
33*c5ffc49bSmseidel<bookmark_value>logical expressions</bookmark_value>
34*c5ffc49bSmseidel<bookmark_value>formulating conditions</bookmark_value>
35*c5ffc49bSmseidel<bookmark_value>conditions; in fields and sections</bookmark_value>
36*c5ffc49bSmseidel<bookmark_value>fields;defining conditions</bookmark_value>
37*c5ffc49bSmseidel<bookmark_value>sections;defining conditions</bookmark_value>
38*c5ffc49bSmseidel<bookmark_value>variables; in conditions</bookmark_value>
39*c5ffc49bSmseidel<bookmark_value>user data;in conditions</bookmark_value>
40*c5ffc49bSmseidel<bookmark_value>databases;in conditions</bookmark_value>
41*c5ffc49bSmseidel<bookmark_value>hiding; database fields</bookmark_value>
42cdf0e10cSrcweir</bookmark>
43cdf0e10cSrcweir<paragraph xml-lang="en-US" id="hd_id3145828" role="heading" level="1" l10n="CHG"
44*c5ffc49bSmseideloldref="1"><variable id="defining_conditions"><link href="text/swriter/01/04090200.xhp">Defining Conditions</link>
45cdf0e10cSrcweir</variable></paragraph>
46*c5ffc49bSmseidel<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>
47*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3147171" role="paragraph" l10n="U" oldref="93">You can define conditions for the following field types:</paragraph>
48*c5ffc49bSmseidel<list type="ordered">
49*c5ffc49bSmseidel<listitem>
50*c5ffc49bSmseidel<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>
51*c5ffc49bSmseidel</listitem>
52*c5ffc49bSmseidel<listitem>
53*c5ffc49bSmseidel<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>
54*c5ffc49bSmseidel</listitem>
55*c5ffc49bSmseidel<listitem>
56*c5ffc49bSmseidel<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>
57*c5ffc49bSmseidel</listitem>
58*c5ffc49bSmseidel<listitem>
59*c5ffc49bSmseidel<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>
60*c5ffc49bSmseidel</listitem>
61*c5ffc49bSmseidel</list>
62*c5ffc49bSmseidel<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>
63*c5ffc49bSmseidel<table id="tbl_id3153537">
64*c5ffc49bSmseidel<tablerow>
65*c5ffc49bSmseidel<tablecell>
66*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3153677" role="tablecontent" l10n="CHG" oldref="19">TRUE</paragraph>
67*c5ffc49bSmseidel</tablecell>
68*c5ffc49bSmseidel<tablecell>
69*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3152960" role="tablecontent" l10n="U" oldref="20">The condition is always met. You can also enter any value not equal to 0 as the conditional text.</paragraph>
70*c5ffc49bSmseidel</tablecell>
71*c5ffc49bSmseidel</tablerow>
72*c5ffc49bSmseidel<tablerow>
73*c5ffc49bSmseidel<tablecell>
74*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3155900" role="tablecontent" l10n="CHG" oldref="21">FALSE</paragraph>
75*c5ffc49bSmseidel</tablecell>
76*c5ffc49bSmseidel<tablecell>
77*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3154191" role="tablecontent" l10n="U" oldref="22">The condition is not met. You can also enter the value 0.</paragraph>
78*c5ffc49bSmseidel</tablecell>
79*c5ffc49bSmseidel</tablerow>
80*c5ffc49bSmseidel</table>
81*c5ffc49bSmseidel<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>
82*c5ffc49bSmseidel<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>
83*c5ffc49bSmseidel<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>
84*c5ffc49bSmseidel<list type="ordered">
85*c5ffc49bSmseidel<listitem>
86*c5ffc49bSmseidel<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>
87*c5ffc49bSmseidel</listitem>
88*c5ffc49bSmseidel<listitem>
89*c5ffc49bSmseidel<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>
90*c5ffc49bSmseidel</listitem>
91*c5ffc49bSmseidel<listitem>
92*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3149174" role="listitem" l10n="U" oldref="94">Variables based on user data</paragraph>
93*c5ffc49bSmseidel</listitem>
94*c5ffc49bSmseidel<listitem>
95*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3145781" role="listitem" l10n="U" oldref="28">Variables based on the contents of database fields</paragraph>
96*c5ffc49bSmseidel</listitem>
97*c5ffc49bSmseidel</list>
98*c5ffc49bSmseidel<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>
99*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="hd_id3151375" role="heading" level="2" l10n="U"
100*c5ffc49bSmseideloldref="30">Conditions and Variables</paragraph>
101*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3150122" role="paragraph" l10n="U" oldref="31">The following examples use a variable called "x":</paragraph>
102*c5ffc49bSmseidel<table id="tbl_id3155867">
103*c5ffc49bSmseidel<tablerow>
104*c5ffc49bSmseidel<tablecell>
105*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3147417" role="tablecontent" l10n="U" oldref="32">x == 1 or x EQ 1</paragraph>
106*c5ffc49bSmseidel</tablecell>
107*c5ffc49bSmseidel<tablecell>
108*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3147500" role="tablecontent" l10n="U" oldref="33">The condition is true if "x" is equal to 1.</paragraph>
109*c5ffc49bSmseidel</tablecell>
110*c5ffc49bSmseidel</tablerow>
111*c5ffc49bSmseidel<tablerow>
112*c5ffc49bSmseidel<tablecell>
113*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3145259" role="tablecontent" l10n="U" oldref="34">x != 1 or x NEQ 1</paragraph>
114*c5ffc49bSmseidel</tablecell>
115*c5ffc49bSmseidel<tablecell>
116*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3150551" role="tablecontent" l10n="U" oldref="35">The condition is true if "x" does not equal 1.</paragraph>
117*c5ffc49bSmseidel</tablecell>
118*c5ffc49bSmseidel</tablerow>
119*c5ffc49bSmseidel<tablerow>
120*c5ffc49bSmseidel<tablecell>
121*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3147749" role="tablecontent" l10n="U" oldref="36">sinx == 0</paragraph>
122*c5ffc49bSmseidel</tablecell>
123*c5ffc49bSmseidel<tablecell>
124*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3146345" role="tablecontent" l10n="U" oldref="37">The condition is true if "x" is a multiple of pi.</paragraph>
125*c5ffc49bSmseidel</tablecell>
126*c5ffc49bSmseidel</tablerow>
127*c5ffc49bSmseidel</table>
128*c5ffc49bSmseidel<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>
129*c5ffc49bSmseidel<table id="tbl_id3148855">
130*c5ffc49bSmseidel<tablerow>
131*c5ffc49bSmseidel<tablecell>
132*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3151078" role="tablecontent" l10n="U" oldref="39">x == "ABC" or x EQ "ABC"</paragraph>
133*c5ffc49bSmseidel</tablecell>
134*c5ffc49bSmseidel<tablecell>
135*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3150162" role="tablecontent" l10n="U" oldref="40">Checks if variable "x" contains (true) the "ABC" string, or not (false).</paragraph>
136*c5ffc49bSmseidel</tablecell>
137*c5ffc49bSmseidel</tablerow>
138*c5ffc49bSmseidel<tablerow>
139*c5ffc49bSmseidel<tablecell>
140*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3153301" role="tablecontent" l10n="U" oldref="41">x == "" or x EQ ""</paragraph>
141*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3156120" role="tablecontent" l10n="U" oldref="90">or</paragraph>
142*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3156133" role="tablecontent" l10n="U" oldref="42">!x or NOT x</paragraph>
143*c5ffc49bSmseidel</tablecell>
144*c5ffc49bSmseidel<tablecell>
145*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3156112" role="tablecontent" l10n="U" oldref="44">Checks if the variable "x" contains an empty string.</paragraph>
146*c5ffc49bSmseidel</tablecell>
147*c5ffc49bSmseidel</tablerow>
148*c5ffc49bSmseidel</table>
149*c5ffc49bSmseidel<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>
150*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="hd_id3148791" role="heading" level="2" l10n="U"
151*c5ffc49bSmseideloldref="95">User Data</paragraph>
152*c5ffc49bSmseidel<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><switchinline select="sys"><caseinline select="MAC">%PRODUCTNAME - Preferences</caseinline><defaultinline>Tools - Options</defaultinline></switchinline> - $[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>
153*c5ffc49bSmseidel<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>
154*c5ffc49bSmseidel<table id="tbl_id3153139">
155*c5ffc49bSmseidel<tablerow>
156*c5ffc49bSmseidel<tablecell>
157*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3149632" role="tablehead" l10n="U" oldref="130">Variable</paragraph>
158*c5ffc49bSmseidel</tablecell>
159*c5ffc49bSmseidel<tablecell>
160*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3150662" role="tablehead" l10n="U" oldref="131">Meaning</paragraph>
161*c5ffc49bSmseidel</tablecell>
162*c5ffc49bSmseidel</tablerow>
163*c5ffc49bSmseidel<tablerow>
164*c5ffc49bSmseidel<tablecell>
165*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3154026" role="tablecontent" l10n="U" oldref="98">user_firstname</paragraph>
166*c5ffc49bSmseidel</tablecell>
167*c5ffc49bSmseidel<tablecell>
168*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3149953" role="tablecontent" l10n="U" oldref="99">First name</paragraph>
169*c5ffc49bSmseidel</tablecell>
170*c5ffc49bSmseidel</tablerow>
171*c5ffc49bSmseidel<tablerow>
172*c5ffc49bSmseidel<tablecell>
173*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3147272" role="tablecontent" l10n="U" oldref="100">user_lastname</paragraph>
174*c5ffc49bSmseidel</tablecell>
175*c5ffc49bSmseidel<tablecell>
176*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3149601" role="tablecontent" l10n="U" oldref="101">Last name</paragraph>
177*c5ffc49bSmseidel</tablecell>
178*c5ffc49bSmseidel</tablerow>
179*c5ffc49bSmseidel<tablerow>
180*c5ffc49bSmseidel<tablecell>
181*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3150770" role="tablecontent" l10n="U" oldref="102">user_initials</paragraph>
182*c5ffc49bSmseidel</tablecell>
183*c5ffc49bSmseidel<tablecell>
184*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3155529" role="tablecontent" l10n="U" oldref="103">Initials</paragraph>
185*c5ffc49bSmseidel</tablecell>
186*c5ffc49bSmseidel</tablerow>
187*c5ffc49bSmseidel<tablerow>
188*c5ffc49bSmseidel<tablecell>
189*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3148705" role="tablecontent" l10n="U" oldref="104">user_company</paragraph>
190*c5ffc49bSmseidel</tablecell>
191*c5ffc49bSmseidel<tablecell>
192*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3148728" role="tablecontent" l10n="U" oldref="105">Company</paragraph>
193*c5ffc49bSmseidel</tablecell>
194*c5ffc49bSmseidel</tablerow>
195*c5ffc49bSmseidel<tablerow>
196*c5ffc49bSmseidel<tablecell>
197*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3155361" role="tablecontent" l10n="U" oldref="106">user_street</paragraph>
198*c5ffc49bSmseidel</tablecell>
199*c5ffc49bSmseidel<tablecell>
200*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3154222" role="tablecontent" l10n="U" oldref="107">Street</paragraph>
201*c5ffc49bSmseidel</tablecell>
202*c5ffc49bSmseidel</tablerow>
203*c5ffc49bSmseidel<tablerow>
204*c5ffc49bSmseidel<tablecell>
205*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3145108" role="tablecontent" l10n="U" oldref="108">user_country</paragraph>
206*c5ffc49bSmseidel</tablecell>
207*c5ffc49bSmseidel<tablecell>
208*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3146885" role="tablecontent" l10n="U" oldref="109">Country</paragraph>
209*c5ffc49bSmseidel</tablecell>
210*c5ffc49bSmseidel</tablerow>
211*c5ffc49bSmseidel<tablerow>
212*c5ffc49bSmseidel<tablecell>
213*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3149580" role="tablecontent" l10n="U" oldref="110">user_zipcode</paragraph>
214*c5ffc49bSmseidel</tablecell>
215*c5ffc49bSmseidel<tablecell>
216*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3156241" role="tablecontent" l10n="U" oldref="111">Zip code</paragraph>
217*c5ffc49bSmseidel</tablecell>
218*c5ffc49bSmseidel</tablerow>
219*c5ffc49bSmseidel<tablerow>
220*c5ffc49bSmseidel<tablecell>
221*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3148922" role="tablecontent" l10n="U" oldref="112">user_city</paragraph>
222*c5ffc49bSmseidel</tablecell>
223*c5ffc49bSmseidel<tablecell>
224*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3148945" role="tablecontent" l10n="U" oldref="113">City</paragraph>
225*c5ffc49bSmseidel</tablecell>
226*c5ffc49bSmseidel</tablerow>
227*c5ffc49bSmseidel<tablerow>
228*c5ffc49bSmseidel<tablecell>
229*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3156053" role="tablecontent" l10n="U" oldref="114">user_title</paragraph>
230*c5ffc49bSmseidel</tablecell>
231*c5ffc49bSmseidel<tablecell>
232*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3159219" role="tablecontent" l10n="U" oldref="115">Title</paragraph>
233*c5ffc49bSmseidel</tablecell>
234*c5ffc49bSmseidel</tablerow>
235*c5ffc49bSmseidel<tablerow>
236*c5ffc49bSmseidel<tablecell>
237*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3156435" role="tablecontent" l10n="U" oldref="116">user_position</paragraph>
238*c5ffc49bSmseidel</tablecell>
239*c5ffc49bSmseidel<tablecell>
240*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3145178" role="tablecontent" l10n="U" oldref="117">Position</paragraph>
241*c5ffc49bSmseidel</tablecell>
242*c5ffc49bSmseidel</tablerow>
243*c5ffc49bSmseidel<tablerow>
244*c5ffc49bSmseidel<tablecell>
245*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3150797" role="tablecontent" l10n="U" oldref="118">user_tel_work</paragraph>
246*c5ffc49bSmseidel</tablecell>
247*c5ffc49bSmseidel<tablecell>
248*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3150820" role="tablecontent" l10n="U" oldref="119">Business telephone number</paragraph>
249*c5ffc49bSmseidel</tablecell>
250*c5ffc49bSmseidel</tablerow>
251*c5ffc49bSmseidel<tablerow>
252*c5ffc49bSmseidel<tablecell>
253*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3150894" role="tablecontent" l10n="U" oldref="120">user_tel_home</paragraph>
254*c5ffc49bSmseidel</tablecell>
255*c5ffc49bSmseidel<tablecell>
256*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3155320" role="tablecontent" l10n="U" oldref="121">Home telephone number</paragraph>
257*c5ffc49bSmseidel</tablecell>
258*c5ffc49bSmseidel</tablerow>
259*c5ffc49bSmseidel<tablerow>
260*c5ffc49bSmseidel<tablecell>
261*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3154400" role="tablecontent" l10n="U" oldref="122">user_fax</paragraph>
262*c5ffc49bSmseidel</tablecell>
263*c5ffc49bSmseidel<tablecell>
264*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3153363" role="tablecontent" l10n="U" oldref="123">Fax number</paragraph>
265*c5ffc49bSmseidel</tablecell>
266*c5ffc49bSmseidel</tablerow>
267*c5ffc49bSmseidel<tablerow>
268*c5ffc49bSmseidel<tablecell>
269*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3153390" role="tablecontent" l10n="U" oldref="124">user_email</paragraph>
270*c5ffc49bSmseidel</tablecell>
271*c5ffc49bSmseidel<tablecell>
272*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3154948" role="tablecontent" l10n="U" oldref="125">E-mail address</paragraph>
273*c5ffc49bSmseidel</tablecell>
274*c5ffc49bSmseidel</tablerow>
275*c5ffc49bSmseidel<tablerow>
276*c5ffc49bSmseidel<tablecell>
277*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3145603" role="tablecontent" l10n="U" oldref="126">user_state</paragraph>
278*c5ffc49bSmseidel</tablecell>
279*c5ffc49bSmseidel<tablecell>
280*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3150129" role="tablecontent" l10n="U" oldref="127">State (not in all $[officename] versions)</paragraph>
281*c5ffc49bSmseidel</tablecell>
282*c5ffc49bSmseidel</tablerow>
283*c5ffc49bSmseidel</table>
284*c5ffc49bSmseidel<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>
285*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="hd_id3154115" role="heading" level="2" l10n="U"
286*c5ffc49bSmseideloldref="46">Conditions and Database Fields</paragraph>
287*c5ffc49bSmseidel<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>
288*c5ffc49bSmseidel<table id="tbl_id3154848">
289*c5ffc49bSmseidel<tablerow>
290*c5ffc49bSmseidel<tablecell>
291*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3156066" role="paragraph" l10n="U" oldref="132">Example</paragraph>
292*c5ffc49bSmseidel</tablecell>
293*c5ffc49bSmseidel<tablecell>
294*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3156088" role="paragraph" l10n="U" oldref="133">Meaning</paragraph>
295*c5ffc49bSmseidel</tablecell>
296*c5ffc49bSmseidel</tablerow>
297*c5ffc49bSmseidel<tablerow>
298*c5ffc49bSmseidel<tablecell>
299*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3155948" role="paragraph" l10n="U" oldref="48">Database.Table.Company</paragraph>
300*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3148673" role="paragraph" l10n="U" oldref="91">Database.Table.Company NEQ ""</paragraph>
301*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3148687" role="paragraph" l10n="U" oldref="92">Database.Table.Company != ""</paragraph>
302*c5ffc49bSmseidel</tablecell>
303*c5ffc49bSmseidel<tablecell>
304*c5ffc49bSmseidel<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>
305*c5ffc49bSmseidel</tablecell>
306*c5ffc49bSmseidel</tablerow>
307*c5ffc49bSmseidel<tablerow>
308*c5ffc49bSmseidel<tablecell>
309*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3149977" role="paragraph" l10n="U" oldref="7">!Database.Table.Company</paragraph>
310*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3149991" role="paragraph" l10n="U" oldref="129">NOT Database.Table.Company</paragraph>
311*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3150004" role="paragraph" l10n="U" oldref="50">Database.Table.Company EQ ""</paragraph>
312*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3146911" role="paragraph" l10n="U" oldref="9">Database.Table.Company ==""</paragraph>
313*c5ffc49bSmseidel</tablecell>
314*c5ffc49bSmseidel<tablecell>
315*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3148733" role="paragraph" l10n="U" oldref="8">Returns TRUE if the COMPANY field is empty.</paragraph>
316*c5ffc49bSmseidel</tablecell>
317*c5ffc49bSmseidel</tablerow>
318*c5ffc49bSmseidel<tablerow>
319*c5ffc49bSmseidel<tablecell>
320*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3148762" role="paragraph" l10n="U" oldref="5">Database.Table.Company !="Sun"</paragraph>
321*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3153016" role="paragraph" l10n="U" oldref="149">Database.Table.Company NEQ "Sun"</paragraph>
322*c5ffc49bSmseidel</tablecell>
323*c5ffc49bSmseidel<tablecell>
324*c5ffc49bSmseidel<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 not "Sun". (Exclamation sign represents a logical NOT.)</paragraph>
325*c5ffc49bSmseidel</tablecell>
326*c5ffc49bSmseidel</tablerow>
327*c5ffc49bSmseidel<tablerow>
328*c5ffc49bSmseidel<tablecell>
329*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3154605" role="paragraph" l10n="U" oldref="51">Database.Table.Firstname AND Database.Table.Name</paragraph>
330*c5ffc49bSmseidel</tablecell>
331*c5ffc49bSmseidel<tablecell>
332*c5ffc49bSmseidel<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>
333*c5ffc49bSmseidel</tablecell>
334*c5ffc49bSmseidel</tablerow>
335*c5ffc49bSmseidel</table>
336*c5ffc49bSmseidel<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>
337*c5ffc49bSmseidel<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>
338*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3153891" role="heading" level="3" l10n="U"
339*c5ffc49bSmseideloldref="55">Example: Hiding an Empty Database Field</paragraph>
340*c5ffc49bSmseidel<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>
341*c5ffc49bSmseidel<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>
342*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3147110" role="paragraph" l10n="U" oldref="150">or type the following</paragraph>
343*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3147123" role="paragraph" l10n="U" oldref="151">NOT Addressbook.Addresses.Company</paragraph>
344*c5ffc49bSmseidel<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>
345*c5ffc49bSmseidel<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><switchinline select="sys"><caseinline select="MAC">%PRODUCTNAME - Preferences</caseinline><defaultinline>Tools - Options</defaultinline></switchinline> - %PRODUCTNAME Writer - Formatting Aids</emph>, and clear the <emph>Fields: Hidden paragraphs</emph> check box.</paragraph>
346*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="hd_id3145218" role="heading" level="2" l10n="U"
347*c5ffc49bSmseideloldref="59">Examples of Conditions in Fields</paragraph>
348*c5ffc49bSmseidel<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>
349*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="hd_id3150311" role="heading" level="2" l10n="U"
350*c5ffc49bSmseideloldref="61">To display conditional text based on the number of pages:</paragraph>
351*c5ffc49bSmseidel<list type="ordered">
352*c5ffc49bSmseidel<listitem>
353*c5ffc49bSmseidel<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>
354*c5ffc49bSmseidel</listitem>
355*c5ffc49bSmseidel<listitem>
356*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3147471" role="listitem" l10n="U" oldref="62">In the <emph>Type</emph> list, click "Conditional text".</paragraph>
357*c5ffc49bSmseidel</listitem>
358*c5ffc49bSmseidel<listitem>
359*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3154294" role="listitem" l10n="U" oldref="63">In the <emph>Condition</emph> box, type "page == 1".</paragraph>
360*c5ffc49bSmseidel</listitem>
361*c5ffc49bSmseidel<listitem>
362*c5ffc49bSmseidel<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>
363*c5ffc49bSmseidel</listitem>
364*c5ffc49bSmseidel<listitem>
365*c5ffc49bSmseidel<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>
366*c5ffc49bSmseidel</listitem>
367*c5ffc49bSmseidel<listitem>
368*c5ffc49bSmseidel<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>
369*c5ffc49bSmseidel</listitem>
370*c5ffc49bSmseidel</list>
371*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="hd_id3155814" role="heading" level="2" l10n="U"
372*c5ffc49bSmseideloldref="67">To display conditional text based on a user-defined Variable</paragraph>
373*c5ffc49bSmseidel<list type="ordered">
374*c5ffc49bSmseidel<listitem>
375*c5ffc49bSmseidel<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>
376*c5ffc49bSmseidel</listitem>
377*c5ffc49bSmseidel<listitem>
378*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3155109" role="listitem" l10n="U" oldref="68">In the <emph>Type</emph> list, click "Set Variable".</paragraph>
379*c5ffc49bSmseidel</listitem>
380*c5ffc49bSmseidel<listitem>
381*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3147008" role="listitem" l10n="U" oldref="139">In the <emph>Name</emph> box, type "Profit".</paragraph>
382*c5ffc49bSmseidel</listitem>
383*c5ffc49bSmseidel<listitem>
384*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3147032" role="listitem" l10n="U" oldref="140">In the <emph>Value</emph> box, type "5000".</paragraph>
385*c5ffc49bSmseidel</listitem>
386*c5ffc49bSmseidel<listitem>
387*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3152974" role="listitem" l10n="U" oldref="141">Click <emph>Insert</emph>.</paragraph>
388*c5ffc49bSmseidel</listitem>
389*c5ffc49bSmseidel<listitem>
390*c5ffc49bSmseidel<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>
391*c5ffc49bSmseidel</listitem>
392*c5ffc49bSmseidel<listitem>
393*c5ffc49bSmseidel<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>
394*c5ffc49bSmseidel</listitem>
395*c5ffc49bSmseidel<listitem>
396*c5ffc49bSmseidel<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>
397*c5ffc49bSmseidel</listitem>
398*c5ffc49bSmseidel<listitem>
399*c5ffc49bSmseidel<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>
400*c5ffc49bSmseidel</listitem>
401*c5ffc49bSmseidel<listitem>
402*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3154366" role="listitem" l10n="U" oldref="143">Click <emph>Insert</emph>.</paragraph>
403*c5ffc49bSmseidel</listitem>
404*c5ffc49bSmseidel</list>
405*c5ffc49bSmseidel<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>
406*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="hd_id3155573" role="heading" level="2" l10n="U"
407*c5ffc49bSmseideloldref="74">To display conditional text based on the contents of a database field:</paragraph>
408*c5ffc49bSmseidel<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>
409*c5ffc49bSmseidel<list type="ordered">
410*c5ffc49bSmseidel<listitem>
411*c5ffc49bSmseidel<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>
412*c5ffc49bSmseidel</listitem>
413*c5ffc49bSmseidel<listitem>
414*c5ffc49bSmseidel<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>
415*c5ffc49bSmseidel</listitem>
416*c5ffc49bSmseidel<listitem>
417*c5ffc49bSmseidel<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>
418*c5ffc49bSmseidel</listitem>
419*c5ffc49bSmseidel<listitem>
420*c5ffc49bSmseidel<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>
421*c5ffc49bSmseidel</listitem>
422*c5ffc49bSmseidel<listitem>
423*c5ffc49bSmseidel<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>
424*c5ffc49bSmseidel</listitem>
425*c5ffc49bSmseidel<listitem>
426*c5ffc49bSmseidel<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>
427*c5ffc49bSmseidel</listitem>
428*c5ffc49bSmseidel<listitem>
429*c5ffc49bSmseidel<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>
430*c5ffc49bSmseidel</listitem>
431*c5ffc49bSmseidel</list>
432*c5ffc49bSmseidel<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>
433*c5ffc49bSmseidel<list type="ordered">
434*c5ffc49bSmseidel<listitem>
435*c5ffc49bSmseidel<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>
436*c5ffc49bSmseidel</listitem>
437*c5ffc49bSmseidel<listitem>
438*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3150605" role="listitem" l10n="U" oldref="85">In the <emph>Type</emph> box, click "Conditional text".</paragraph>
439*c5ffc49bSmseidel</listitem>
440*c5ffc49bSmseidel<listitem>
441*c5ffc49bSmseidel<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>
442*c5ffc49bSmseidel</listitem>
443*c5ffc49bSmseidel<listitem>
444*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3151303" role="listitem" l10n="U" oldref="87">In the <emph>Then</emph> box, type "Dear".</paragraph>
445*c5ffc49bSmseidel</listitem>
446*c5ffc49bSmseidel<listitem>
447*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3149138" role="listitem" l10n="CHG" oldref="88">In the <emph>Else</emph> box, type "Hello".</paragraph>
448*c5ffc49bSmseidel</listitem>
449*c5ffc49bSmseidel<listitem>
450*c5ffc49bSmseidel<paragraph xml-lang="en-US" id="par_id3149163" role="listitem" l10n="U" oldref="148">Click <emph>Insert</emph>.</paragraph>
451*c5ffc49bSmseidel</listitem>
452*c5ffc49bSmseidel</list>
453*c5ffc49bSmseidel</body>
454cdf0e10cSrcweir</helpdocument>
455