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