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