1cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?> 2cdf0e10cSrcweir 382a1df74SAndrew Rist<!--*********************************************************** 4cdf0e10cSrcweir * 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 12cdf0e10cSrcweir * 1382a1df74SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 14cdf0e10cSrcweir * 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. 21cdf0e10cSrcweir * 2282a1df74SAndrew Rist ***********************************************************--> 2382a1df74SAndrew Rist 24e91968a5Smseidel<helpdocument version="1.0"> 25cdf0e10cSrcweir<meta> 26cdf0e10cSrcweir<topic id="textswriter0104090200xml" indexer="include" status="PUBLISH"> 27cdf0e10cSrcweir<title xml-lang="en-US" id="tit">Defining Conditions</title> 28cdf0e10cSrcweir<filename>/text/swriter/01/04090200.xhp</filename> 29cdf0e10cSrcweir</topic> 30cdf0e10cSrcweir</meta> 31cdf0e10cSrcweir<body> 32e91968a5Smseidel<bookmark xml-lang="en-US" branch="index" id="bm_id3145828"> 33e91968a5Smseidel<bookmark_value>logical expressions</bookmark_value> 34cdf0e10cSrcweir<bookmark_value>formulating conditions</bookmark_value> 35cdf0e10cSrcweir<bookmark_value>conditions; in fields and sections</bookmark_value> 36cdf0e10cSrcweir<bookmark_value>fields;defining conditions</bookmark_value> 37cdf0e10cSrcweir<bookmark_value>sections;defining conditions</bookmark_value> 38cdf0e10cSrcweir<bookmark_value>variables; in conditions</bookmark_value> 39cdf0e10cSrcweir<bookmark_value>user data;in conditions</bookmark_value> 40cdf0e10cSrcweir<bookmark_value>databases;in conditions</bookmark_value> 41cdf0e10cSrcweir<bookmark_value>hiding; database fields</bookmark_value> 42cdf0e10cSrcweir</bookmark> 43*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="hd_id3145828" role="heading" level="1" l10n="CHG"><variable id="defining_conditions"><link href="text/swriter/01/04090200.xhp">Defining Conditions</link> 44cdf0e10cSrcweir</variable></paragraph> 45*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3145242" role="paragraph" l10n="CHG">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> 46*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3147171" role="paragraph" l10n="U">You can define conditions for the following field types:</paragraph> 47cdf0e10cSrcweir<list type="ordered"> 48cdf0e10cSrcweir<listitem> 49*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3151185" role="listitem" l10n="U">Conditional text: displays text A if the condition is true, or text B if the condition is false.</paragraph> 50cdf0e10cSrcweir</listitem> 51cdf0e10cSrcweir<listitem> 52*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3149289" role="listitem" l10n="U">Hidden text: hides the contents of the field if the condition is true.</paragraph> 53cdf0e10cSrcweir</listitem> 54cdf0e10cSrcweir<listitem> 55*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3145412" role="listitem" l10n="U">Hidden paragraph: hides the paragraph if the condition is true.</paragraph> 56cdf0e10cSrcweir</listitem> 57cdf0e10cSrcweir<listitem> 58*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3147515" role="listitem" l10n="U">Any record and next record: controls the access to database records.</paragraph> 59cdf0e10cSrcweir</listitem> 60cdf0e10cSrcweir</list> 61*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3149802" role="paragraph" l10n="U">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> 62cdf0e10cSrcweir<table id="tbl_id3153537"> 63cdf0e10cSrcweir<tablerow> 64cdf0e10cSrcweir<tablecell> 65*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3153677" role="tablecontent" l10n="CHG">TRUE</paragraph> 66cdf0e10cSrcweir</tablecell> 67cdf0e10cSrcweir<tablecell> 68*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3152960" role="tablecontent" l10n="U">The condition is always met. You can also enter any value not equal to 0 as the conditional text.</paragraph> 69cdf0e10cSrcweir</tablecell> 70cdf0e10cSrcweir</tablerow> 71cdf0e10cSrcweir<tablerow> 72cdf0e10cSrcweir<tablecell> 73*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3155900" role="tablecontent" l10n="CHG">FALSE</paragraph> 74cdf0e10cSrcweir</tablecell> 75cdf0e10cSrcweir<tablecell> 76*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3154191" role="tablecontent" l10n="U">The condition is not met. You can also enter the value 0.</paragraph> 77cdf0e10cSrcweir</tablecell> 78cdf0e10cSrcweir</tablerow> 79cdf0e10cSrcweir</table> 80*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3147090" role="note" l10n="U">If you leave the <emph>Condition</emph> box empty, the condition is interpreted as not being met.</paragraph> 81*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3148980" role="paragraph" l10n="U">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> 82*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3153638" role="paragraph" l10n="U">You can use the following types of variables when you define a condition:</paragraph> 83cdf0e10cSrcweir<list type="ordered"> 84cdf0e10cSrcweir<listitem> 85*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3155135" role="listitem" l10n="U">Predefined <link href="text/swriter/02/14020000.xhp">$[officename] variables</link> that use statistics on document properties</paragraph> 86cdf0e10cSrcweir</listitem> 87cdf0e10cSrcweir<listitem> 88*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3156273" role="listitem" l10n="U">Custom variables, that are a created with the "Set variable" field</paragraph> 89cdf0e10cSrcweir</listitem> 90cdf0e10cSrcweir<listitem> 91*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3149174" role="listitem" l10n="U">Variables based on user data</paragraph> 92cdf0e10cSrcweir</listitem> 93cdf0e10cSrcweir<listitem> 94*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3145781" role="listitem" l10n="U">Variables based on the contents of database fields</paragraph> 95cdf0e10cSrcweir</listitem> 96cdf0e10cSrcweir</list> 97*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3155916" role="paragraph" l10n="U">You cannot use internal variables, such as page and chapter numbers, in condition expression.</paragraph> 98*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="hd_id3151375" role="heading" level="2" l10n="U">Conditions and Variables</paragraph> 99*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3150122" role="paragraph" l10n="U">The following examples use a variable called "x":</paragraph> 100cdf0e10cSrcweir<table id="tbl_id3155867"> 101cdf0e10cSrcweir<tablerow> 102cdf0e10cSrcweir<tablecell> 103*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3147417" role="tablecontent" l10n="U">x == 1 or x EQ 1</paragraph> 104cdf0e10cSrcweir</tablecell> 105cdf0e10cSrcweir<tablecell> 106*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3147500" role="tablecontent" l10n="U">The condition is true if "x" is equal to 1.</paragraph> 107cdf0e10cSrcweir</tablecell> 108cdf0e10cSrcweir</tablerow> 109cdf0e10cSrcweir<tablerow> 110cdf0e10cSrcweir<tablecell> 111*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3145259" role="tablecontent" l10n="U">x != 1 or x NEQ 1</paragraph> 112cdf0e10cSrcweir</tablecell> 113cdf0e10cSrcweir<tablecell> 114*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3150551" role="tablecontent" l10n="U">The condition is true if "x" does not equal 1.</paragraph> 115cdf0e10cSrcweir</tablecell> 116cdf0e10cSrcweir</tablerow> 117cdf0e10cSrcweir<tablerow> 118cdf0e10cSrcweir<tablecell> 119*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3147749" role="tablecontent" l10n="U">sinx == 0</paragraph> 120cdf0e10cSrcweir</tablecell> 121cdf0e10cSrcweir<tablecell> 122*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3146345" role="tablecontent" l10n="U">The condition is true if "x" is a multiple of pi.</paragraph> 123cdf0e10cSrcweir</tablecell> 124cdf0e10cSrcweir</tablerow> 125cdf0e10cSrcweir</table> 126*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3149846" role="paragraph" l10n="U">To use comparative operators with strings, the operands must be bounded by double quotation marks:</paragraph> 127cdf0e10cSrcweir<table id="tbl_id3148855"> 128cdf0e10cSrcweir<tablerow> 129cdf0e10cSrcweir<tablecell> 130*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3151078" role="tablecontent" l10n="U">x == "ABC" or x EQ "ABC"</paragraph> 131cdf0e10cSrcweir</tablecell> 132cdf0e10cSrcweir<tablecell> 133*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3150162" role="tablecontent" l10n="U">Checks if variable "x" contains (true) the "ABC" string, or not (false).</paragraph> 134cdf0e10cSrcweir</tablecell> 135cdf0e10cSrcweir</tablerow> 136cdf0e10cSrcweir<tablerow> 137cdf0e10cSrcweir<tablecell> 138*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3153301" role="tablecontent" l10n="U">x == "" or x EQ ""</paragraph> 139*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3156120" role="tablecontent" l10n="U">or</paragraph> 140*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3156133" role="tablecontent" l10n="U">!x or NOT x</paragraph> 141cdf0e10cSrcweir</tablecell> 142cdf0e10cSrcweir<tablecell> 143*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3156112" role="tablecontent" l10n="U">Checks if the variable "x" contains an empty string.</paragraph> 144cdf0e10cSrcweir</tablecell> 145cdf0e10cSrcweir</tablerow> 146cdf0e10cSrcweir</table> 147*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3150097" role="note" l10n="CHG">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> 148*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="hd_id3148791" role="heading" level="2" l10n="U">User Data</paragraph> 149*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3150028" role="paragraph" l10n="U">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> 150*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3153124" role="paragraph" l10n="U">The following table lists user data variables and their meanings:</paragraph> 151cdf0e10cSrcweir<table id="tbl_id3153139"> 152cdf0e10cSrcweir<tablerow> 153cdf0e10cSrcweir<tablecell> 154*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3149632" role="tablehead" l10n="U">Variable</paragraph> 155cdf0e10cSrcweir</tablecell> 156cdf0e10cSrcweir<tablecell> 157*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3150662" role="tablehead" l10n="U">Meaning</paragraph> 158cdf0e10cSrcweir</tablecell> 159cdf0e10cSrcweir</tablerow> 160cdf0e10cSrcweir<tablerow> 161cdf0e10cSrcweir<tablecell> 162*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3154026" role="tablecontent" l10n="U">user_firstname</paragraph> 163cdf0e10cSrcweir</tablecell> 164cdf0e10cSrcweir<tablecell> 165*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3149953" role="tablecontent" l10n="U">First name</paragraph> 166cdf0e10cSrcweir</tablecell> 167cdf0e10cSrcweir</tablerow> 168cdf0e10cSrcweir<tablerow> 169cdf0e10cSrcweir<tablecell> 170*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3147272" role="tablecontent" l10n="U">user_lastname</paragraph> 171cdf0e10cSrcweir</tablecell> 172cdf0e10cSrcweir<tablecell> 173*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3149601" role="tablecontent" l10n="U">Last name</paragraph> 174cdf0e10cSrcweir</tablecell> 175cdf0e10cSrcweir</tablerow> 176cdf0e10cSrcweir<tablerow> 177cdf0e10cSrcweir<tablecell> 178*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3150770" role="tablecontent" l10n="U">user_initials</paragraph> 179cdf0e10cSrcweir</tablecell> 180cdf0e10cSrcweir<tablecell> 181*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3155529" role="tablecontent" l10n="U">Initials</paragraph> 182cdf0e10cSrcweir</tablecell> 183cdf0e10cSrcweir</tablerow> 184cdf0e10cSrcweir<tablerow> 185cdf0e10cSrcweir<tablecell> 186*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3148705" role="tablecontent" l10n="U">user_company</paragraph> 187cdf0e10cSrcweir</tablecell> 188cdf0e10cSrcweir<tablecell> 189*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3148728" role="tablecontent" l10n="U">Company</paragraph> 190cdf0e10cSrcweir</tablecell> 191cdf0e10cSrcweir</tablerow> 192cdf0e10cSrcweir<tablerow> 193cdf0e10cSrcweir<tablecell> 194*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3155361" role="tablecontent" l10n="U">user_street</paragraph> 195cdf0e10cSrcweir</tablecell> 196cdf0e10cSrcweir<tablecell> 197*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3154222" role="tablecontent" l10n="U">Street</paragraph> 198cdf0e10cSrcweir</tablecell> 199cdf0e10cSrcweir</tablerow> 200cdf0e10cSrcweir<tablerow> 201cdf0e10cSrcweir<tablecell> 202*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3145108" role="tablecontent" l10n="U">user_country</paragraph> 203cdf0e10cSrcweir</tablecell> 204cdf0e10cSrcweir<tablecell> 205*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3146885" role="tablecontent" l10n="U">Country</paragraph> 206cdf0e10cSrcweir</tablecell> 207cdf0e10cSrcweir</tablerow> 208cdf0e10cSrcweir<tablerow> 209cdf0e10cSrcweir<tablecell> 210*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3149580" role="tablecontent" l10n="U">user_zipcode</paragraph> 211cdf0e10cSrcweir</tablecell> 212cdf0e10cSrcweir<tablecell> 213*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3156241" role="tablecontent" l10n="U">Zip code</paragraph> 214cdf0e10cSrcweir</tablecell> 215cdf0e10cSrcweir</tablerow> 216cdf0e10cSrcweir<tablerow> 217cdf0e10cSrcweir<tablecell> 218*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3148922" role="tablecontent" l10n="U">user_city</paragraph> 219cdf0e10cSrcweir</tablecell> 220cdf0e10cSrcweir<tablecell> 221*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3148945" role="tablecontent" l10n="U">City</paragraph> 222cdf0e10cSrcweir</tablecell> 223cdf0e10cSrcweir</tablerow> 224cdf0e10cSrcweir<tablerow> 225cdf0e10cSrcweir<tablecell> 226*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3156053" role="tablecontent" l10n="U">user_title</paragraph> 227cdf0e10cSrcweir</tablecell> 228cdf0e10cSrcweir<tablecell> 229*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3159219" role="tablecontent" l10n="U">Title</paragraph> 230cdf0e10cSrcweir</tablecell> 231cdf0e10cSrcweir</tablerow> 232cdf0e10cSrcweir<tablerow> 233cdf0e10cSrcweir<tablecell> 234*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3156435" role="tablecontent" l10n="U">user_position</paragraph> 235cdf0e10cSrcweir</tablecell> 236cdf0e10cSrcweir<tablecell> 237*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3145178" role="tablecontent" l10n="U">Position</paragraph> 238cdf0e10cSrcweir</tablecell> 239cdf0e10cSrcweir</tablerow> 240cdf0e10cSrcweir<tablerow> 241cdf0e10cSrcweir<tablecell> 242*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3150797" role="tablecontent" l10n="U">user_tel_work</paragraph> 243cdf0e10cSrcweir</tablecell> 244cdf0e10cSrcweir<tablecell> 245*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3150820" role="tablecontent" l10n="U">Business telephone number</paragraph> 246cdf0e10cSrcweir</tablecell> 247cdf0e10cSrcweir</tablerow> 248cdf0e10cSrcweir<tablerow> 249cdf0e10cSrcweir<tablecell> 250*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3150894" role="tablecontent" l10n="U">user_tel_home</paragraph> 251cdf0e10cSrcweir</tablecell> 252cdf0e10cSrcweir<tablecell> 253*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3155320" role="tablecontent" l10n="U">Home telephone number</paragraph> 254cdf0e10cSrcweir</tablecell> 255cdf0e10cSrcweir</tablerow> 256cdf0e10cSrcweir<tablerow> 257cdf0e10cSrcweir<tablecell> 258*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3154400" role="tablecontent" l10n="U">user_fax</paragraph> 259cdf0e10cSrcweir</tablecell> 260cdf0e10cSrcweir<tablecell> 261*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3153363" role="tablecontent" l10n="U">Fax number</paragraph> 262cdf0e10cSrcweir</tablecell> 263cdf0e10cSrcweir</tablerow> 264cdf0e10cSrcweir<tablerow> 265cdf0e10cSrcweir<tablecell> 266*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3153390" role="tablecontent" l10n="U">user_email</paragraph> 267cdf0e10cSrcweir</tablecell> 268cdf0e10cSrcweir<tablecell> 269*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3154948" role="tablecontent" l10n="U">E-mail address</paragraph> 270cdf0e10cSrcweir</tablecell> 271cdf0e10cSrcweir</tablerow> 272cdf0e10cSrcweir<tablerow> 273cdf0e10cSrcweir<tablecell> 274*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3145603" role="tablecontent" l10n="U">user_state</paragraph> 275cdf0e10cSrcweir</tablecell> 276cdf0e10cSrcweir<tablecell> 277*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3150129" role="tablecontent" l10n="U">State (not in all $[officename] versions)</paragraph> 278cdf0e10cSrcweir</tablecell> 279cdf0e10cSrcweir</tablerow> 280cdf0e10cSrcweir</table> 281*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3150147" role="paragraph" l10n="U">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> 282*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="hd_id3154115" role="heading" level="2" l10n="U">Conditions and Database Fields</paragraph> 283*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3154128" role="paragraph" l10n="U">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> 284cdf0e10cSrcweir<table id="tbl_id3154848"> 285cdf0e10cSrcweir<tablerow> 286cdf0e10cSrcweir<tablecell> 287*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3156066" role="paragraph" l10n="U">Example</paragraph> 288cdf0e10cSrcweir</tablecell> 289cdf0e10cSrcweir<tablecell> 290*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3156088" role="paragraph" l10n="U">Meaning</paragraph> 291cdf0e10cSrcweir</tablecell> 292cdf0e10cSrcweir</tablerow> 293cdf0e10cSrcweir<tablerow> 294cdf0e10cSrcweir<tablecell> 295*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3155948" role="paragraph" l10n="U">Database.Table.Company</paragraph> 296*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3148673" role="paragraph" l10n="U">Database.Table.Company NEQ ""</paragraph> 297*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3148687" role="paragraph" l10n="U">Database.Table.Company != ""</paragraph> 298cdf0e10cSrcweir</tablecell> 299cdf0e10cSrcweir<tablecell> 300*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3155373" role="paragraph" l10n="U">The condition is true if the COMPANY field is not empty. (In the first example, no operator is required.)</paragraph> 301cdf0e10cSrcweir</tablecell> 302cdf0e10cSrcweir</tablerow> 303cdf0e10cSrcweir<tablerow> 304cdf0e10cSrcweir<tablecell> 305*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3149977" role="paragraph" l10n="U">!Database.Table.Company</paragraph> 306*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3149991" role="paragraph" l10n="U">NOT Database.Table.Company</paragraph> 307*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3150004" role="paragraph" l10n="U">Database.Table.Company EQ ""</paragraph> 308*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3146911" role="paragraph" l10n="U">Database.Table.Company ==""</paragraph> 309cdf0e10cSrcweir</tablecell> 310cdf0e10cSrcweir<tablecell> 311*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3148733" role="paragraph" l10n="U">Returns TRUE if the COMPANY field is empty.</paragraph> 312cdf0e10cSrcweir</tablecell> 313cdf0e10cSrcweir</tablerow> 314cdf0e10cSrcweir<tablerow> 315cdf0e10cSrcweir<tablecell> 316*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3148762" role="paragraph" l10n="U">Database.Table.Company !="Sun"</paragraph> 317*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3153016" role="paragraph" l10n="U">Database.Table.Company NEQ "Sun"</paragraph> 318cdf0e10cSrcweir</tablecell> 319cdf0e10cSrcweir<tablecell> 320*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3153040" role="paragraph" l10n="U">Returns TRUE if the current entry in the COMPANY field is not "Sun". (Exclamation sign represents a logical NOT.)</paragraph> 321cdf0e10cSrcweir</tablecell> 322cdf0e10cSrcweir</tablerow> 323cdf0e10cSrcweir<tablerow> 324cdf0e10cSrcweir<tablecell> 325*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3154605" role="paragraph" l10n="U">Database.Table.Firstname AND Database.Table.Name</paragraph> 326cdf0e10cSrcweir</tablecell> 327cdf0e10cSrcweir<tablecell> 328*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3153059" role="paragraph" l10n="U">Returns TRUE if the record contains the first and the last name.</paragraph> 329cdf0e10cSrcweir</tablecell> 330cdf0e10cSrcweir</tablerow> 331cdf0e10cSrcweir</table> 332*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3159247" role="note" l10n="U">Note the difference between the boolean NOT "!" and the comparative operator not equal "!=" (NEQ).</paragraph> 333*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3153876" role="paragraph" l10n="CHG">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> 334*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3153891" role="heading" level="3" l10n="U">Example: Hiding an Empty Database Field</paragraph> 335*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3150051" role="paragraph" l10n="U">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> 336*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3150067" role="paragraph" l10n="CHG">Select the <emph>Hidden Paragraph</emph> list entry, and type the following condition: Addressbook.Addresses.Company EQ ""</paragraph> 337*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3147110" role="paragraph" l10n="U">or type the following</paragraph> 338*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3147123" role="paragraph" l10n="U">NOT Addressbook.Addresses.Company</paragraph> 339*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3147136" role="paragraph" l10n="U">If the COMPANY database field is empty, the condition is true and the paragraph is hidden.</paragraph> 340*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3150232" role="note" l10n="CHG">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> 341*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="hd_id3145218" role="heading" level="2" l10n="U">Examples of Conditions in Fields</paragraph> 342*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3145231" role="paragraph" l10n="U">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> 343*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="hd_id3150311" role="heading" level="2" l10n="U">To display conditional text based on the number of pages:</paragraph> 344cdf0e10cSrcweir<list type="ordered"> 345cdf0e10cSrcweir<listitem> 346*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3150333" role="listitem" l10n="U">Choose <emph>Insert - Fields - Other</emph>, and then click the <emph>Functions</emph> tab.</paragraph> 347cdf0e10cSrcweir</listitem> 348cdf0e10cSrcweir<listitem> 349*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3147471" role="listitem" l10n="U">In the <emph>Type</emph> list, click "Conditional text".</paragraph> 350cdf0e10cSrcweir</listitem> 351cdf0e10cSrcweir<listitem> 352*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3154294" role="listitem" l10n="U">In the <emph>Condition</emph> box, type "page == 1".</paragraph> 353cdf0e10cSrcweir</listitem> 354cdf0e10cSrcweir<listitem> 355*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3154319" role="listitem" l10n="U">In the <emph>Then</emph> box, type "There is only one page".</paragraph> 356cdf0e10cSrcweir</listitem> 357cdf0e10cSrcweir<listitem> 358*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3150640" role="listitem" l10n="U">In the <emph>Or</emph> box, type "There are several pages".</paragraph> 359cdf0e10cSrcweir</listitem> 360cdf0e10cSrcweir<listitem> 361*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3153086" role="listitem" l10n="U">Click <emph>Insert</emph>, and then click <emph>Close</emph>.</paragraph> 362cdf0e10cSrcweir</listitem> 363cdf0e10cSrcweir</list> 364*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="hd_id3155814" role="heading" level="2" l10n="U">To display conditional text based on a user-defined Variable</paragraph> 365cdf0e10cSrcweir<list type="ordered"> 366cdf0e10cSrcweir<listitem> 367*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3155836" role="listitem" l10n="U">Choose <emph>Insert - Fields - Other</emph>, and then click the <emph>Variables</emph> tab.</paragraph> 368cdf0e10cSrcweir</listitem> 369cdf0e10cSrcweir<listitem> 370*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3155109" role="listitem" l10n="U">In the <emph>Type</emph> list, click "Set Variable".</paragraph> 371cdf0e10cSrcweir</listitem> 372cdf0e10cSrcweir<listitem> 373*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3147008" role="listitem" l10n="U">In the <emph>Name</emph> box, type "Profit".</paragraph> 374cdf0e10cSrcweir</listitem> 375cdf0e10cSrcweir<listitem> 376*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3147032" role="listitem" l10n="U">In the <emph>Value</emph> box, type "5000".</paragraph> 377cdf0e10cSrcweir</listitem> 378cdf0e10cSrcweir<listitem> 379*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3152974" role="listitem" l10n="U">Click <emph>Insert</emph>.</paragraph> 380cdf0e10cSrcweir</listitem> 381cdf0e10cSrcweir<listitem> 382*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3152998" role="listitem" l10n="U">Click the <emph>Functions</emph> tab, and click "Conditional text" in the <emph>Type</emph> list.</paragraph> 383cdf0e10cSrcweir</listitem> 384cdf0e10cSrcweir<listitem> 385*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3150952" role="listitem" l10n="U">In the <emph>Condition</emph> box, type "Profit < 5000".</paragraph> 386cdf0e10cSrcweir</listitem> 387cdf0e10cSrcweir<listitem> 388*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3156291" role="listitem" l10n="U">In the <emph>Then</emph> box, type "Target is not met".</paragraph> 389cdf0e10cSrcweir</listitem> 390cdf0e10cSrcweir<listitem> 391*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3156317" role="listitem" l10n="U">In the <emph>Or</emph> box, type "Target is met".</paragraph> 392cdf0e10cSrcweir</listitem> 393cdf0e10cSrcweir<listitem> 394*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3154366" role="listitem" l10n="U">Click <emph>Insert</emph>.</paragraph> 395cdf0e10cSrcweir</listitem> 396cdf0e10cSrcweir</list> 397*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3154389" role="paragraph" l10n="U">To edit the contents of the "Profit" variable, double-click the variable field.</paragraph> 398*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="hd_id3155573" role="heading" level="2" l10n="U">To display conditional text based on the contents of a database field:</paragraph> 399*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3155587" role="paragraph" l10n="CHG">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> 400cdf0e10cSrcweir<list type="ordered"> 401cdf0e10cSrcweir<listitem> 402*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3150523" role="listitem" l10n="U">Choose <emph>Insert - Fields - Other</emph>, and then click the <emph>Database</emph> tab.</paragraph> 403cdf0e10cSrcweir</listitem> 404cdf0e10cSrcweir<listitem> 405*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3148811" role="listitem" l10n="U">In the <emph>Type</emph> list, click "Mail merge fields".</paragraph> 406cdf0e10cSrcweir</listitem> 407cdf0e10cSrcweir<listitem> 408*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3148841" role="listitem" l10n="U">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> 409cdf0e10cSrcweir</listitem> 410cdf0e10cSrcweir<listitem> 411*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3147549" role="listitem" l10n="U">In the document, place the cursor between the two fields, press Space, and then return to the <emph>Fields</emph> dialog:</paragraph> 412cdf0e10cSrcweir</listitem> 413cdf0e10cSrcweir<listitem> 414*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3150416" role="listitem" l10n="U">Click the <emph>Functions</emph> tab, and then click "Conditional text" in the <emph>Type</emph> list.</paragraph> 415cdf0e10cSrcweir</listitem> 416cdf0e10cSrcweir<listitem> 417*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3153589" role="listitem" l10n="U">In the <emph>Condition</emph> box, type: "Addressbook.addresses.firstname".</paragraph> 418cdf0e10cSrcweir</listitem> 419cdf0e10cSrcweir<listitem> 420*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3153615" role="listitem" l10n="U">In the <emph>Then</emph> box, type a space and leave the <emph>Or</emph> box blank.</paragraph> 421cdf0e10cSrcweir</listitem> 422cdf0e10cSrcweir</list> 423*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3153562" role="paragraph" l10n="U">You can now use a condition to insert text based on the contents of the First Name field.</paragraph> 424cdf0e10cSrcweir<list type="ordered"> 425cdf0e10cSrcweir<listitem> 426*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3150574" role="listitem" l10n="U">In the <emph>Fields</emph> dialog, click the <emph>Functions</emph> tab.</paragraph> 427cdf0e10cSrcweir</listitem> 428cdf0e10cSrcweir<listitem> 429*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3150605" role="listitem" l10n="U">In the <emph>Type</emph> box, click "Conditional text".</paragraph> 430cdf0e10cSrcweir</listitem> 431cdf0e10cSrcweir<listitem> 432*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3151277" role="listitem" l10n="U">In the <emph>Condition</emph> box, type: Addressbook.addresses.firstname == "Michael"</paragraph> 433cdf0e10cSrcweir</listitem> 434cdf0e10cSrcweir<listitem> 435*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3151303" role="listitem" l10n="U">In the <emph>Then</emph> box, type "Dear".</paragraph> 436cdf0e10cSrcweir</listitem> 437cdf0e10cSrcweir<listitem> 438*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3149138" role="listitem" l10n="CHG">In the <emph>Else</emph> box, type "Hello".</paragraph> 439cdf0e10cSrcweir</listitem> 440cdf0e10cSrcweir<listitem> 441*be1cfdfaSmseidel<paragraph xml-lang="en-US" id="par_id3149163" role="listitem" l10n="U">Click <emph>Insert</emph>.</paragraph> 442cdf0e10cSrcweir</listitem> 443cdf0e10cSrcweir</list> 444cdf0e10cSrcweir</body> 445cdf0e10cSrcweir</helpdocument> 446