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