summaryrefslogtreecommitdiff
path: root/helpcontent2/source/text/swriter/guide/conditional_text.xhp
blob: ec9a0dc52eac76b889f17bbeeb7ee7533d7f9605 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<?xml version="1.0" encoding="UTF-8"?>
<!--***********************************************************************
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (the "License"); You may not use this file
 *  except in compliance with the License. You may obtain a copy of the
 *  License at http://www.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRUNTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRUNTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc..
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************-->
	
<helpdocument version="1.0">
<meta>
<topic id="textswriterguideconditional_textxml" indexer="include" status="PUBLISH">
<title id="tit" xml-lang="en-US">Conditional Text</title>
<filename>/text/swriter/guide/conditional_text.xhp</filename>
</topic>
<history>
<created date="2003-10-31T00:00:00">Sun Microsystems, Inc.</created>
<lastedited date="2004-08-09T09:25:01">converted from old format - fpe</lastedited>
</history>
</meta>
<body>
<bookmark xml-lang="en-US" branch="index" id="bm_id3155619"><bookmark_value>matching conditional text in fields</bookmark_value>
<bookmark_value>if-then queries as fields</bookmark_value>
<bookmark_value>conditional text; setting up</bookmark_value>
<bookmark_value>text; conditional text</bookmark_value>
</bookmark>
<paragraph role="heading" id="hd_id3155619" xml-lang="en-US" level="1" l10n="U" oldref="4"><variable id="conditional_text"><link href="text/swriter/guide/conditional_text.xhp" name="Conditional Text">Conditional Text</link>
</variable></paragraph>
<paragraph role="paragraph" id="par_id3155879" xml-lang="en-US" l10n="U" oldref="5">You can set up fields in your document that display text when a condition that you define is met. For example, you can define the conditional text that is displayed in a series of reminder letters.</paragraph>
<paragraph role="paragraph" id="par_id3155895" xml-lang="en-US" l10n="U" oldref="6">Setting up conditional text in this example is a two-part process. First you create a variable, and then you create the condition.</paragraph>
<table id="tbl_id3150508">
<tablerow>
<tablecell colspan="" rowspan="">
<paragraph role="paragraph" id="par_id3150532" xml-lang="en-US" l10n="E">
<image id="img_id3150543" src="res/helpimg/mahn1.png" width="138.38mm" height="109.8mm"><alt id="alt_id3150543" xml-lang="en-US">Fields / Variables</alt>
	</image></paragraph>
</tablecell>
</tablerow>
</table>

<paragraph role="heading" id="hd_id3153175" xml-lang="en-US" level="2" l10n="U" oldref="61">To define a conditional variable:</paragraph>
<paragraph role="paragraph" id="par_id3153185" xml-lang="en-US" l10n="U" oldref="62">The first part of the example is to define a variable for the condition statement. </paragraph>
<list type="ordered">
<listitem>
<paragraph role="listitem" id="par_id3155545" xml-lang="en-US" l10n="U" oldref="7">Type "Reminder" in your document, and then add space.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3155566" xml-lang="en-US" l10n="U" oldref="8">Choose <emph>Insert -</emph>
<emph>Fields - Other</emph>, and then click the <emph>Variables</emph> tab.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3147759" xml-lang="en-US" l10n="U" oldref="9">Click "Set variable" in the <emph>Type </emph>list.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3147784" xml-lang="en-US" l10n="U" oldref="10">Type a name for the variable in the <emph>Name</emph> box, for example "Reminder".</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3147810" xml-lang="en-US" l10n="U" oldref="57">Click "Text" in the<emph> Format</emph> list.</paragraph>
</listitem>
</list>
<paragraph role="tip" id="par_id3147290" xml-lang="en-US" l10n="U" oldref="56">To display integers, click the "-1234" format.</paragraph>
<list type="ordered" startwith="6">
<listitem>
<paragraph role="listitem" id="par_id3145614" xml-lang="en-US" l10n="U" oldref="11">Enter "1" in the <emph>Value</emph> box, and then click <emph>Insert</emph>.</paragraph>
</listitem>
</list>
<paragraph role="heading" id="hd_id3145645" xml-lang="en-US" level="2" l10n="U" oldref="63">To define a condition and the conditional text:</paragraph>
<paragraph role="paragraph" id="par_id3145659" xml-lang="en-US" l10n="U" oldref="64">The second part of the example is to define the condition that must be met, and to insert a placeholder for displaying the conditional text in your document.</paragraph>
<list type="ordered">
<listitem>
<paragraph role="listitem" id="par_id3151193" xml-lang="en-US" l10n="U" oldref="12">Place the cursor where you want to insert the conditional text in your text.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3151212" xml-lang="en-US" l10n="U" oldref="65">Choose <emph>Insert -</emph>
<emph>Fields - Other</emph>, and then click the <emph>Functions</emph> tab.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3151250" xml-lang="en-US" l10n="U" oldref="13">Click "Conditional text" in the <emph>Type </emph>list.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3155936" xml-lang="en-US" l10n="U" oldref="14">Type <emph>Reminder EQ "3"</emph> in the <emph>Condition </emph>box. In other words, the conditional text will be displayed when the variable in the field that you defined in the first part of this example is equal to three.</paragraph>
</listitem>
</list>
<paragraph role="paragraph" id="par_id3155969" xml-lang="en-US" l10n="U" oldref="15">The quotation marks enclosing the number 3 indicates that the variable that you defined in the first part of this example is a text string. For a list of operators that you can use when defining your condition, see the Related Topics section of this page.</paragraph>
<table id="tbl_id3155987">
<tablerow>
<tablecell colspan="" rowspan="">
<paragraph role="paragraph" id="par_id3156012" xml-lang="en-US" l10n="E">
<image id="img_id3156019" src="res/helpimg/mahn2.png" width="138.38mm" height="109.8mm"><alt id="alt_id3156019" xml-lang="en-US">Fields / Functions</alt>
	</image></paragraph>
</tablecell>
</tablerow>
</table>

<list type="ordered" startwith="5">
<listitem>
<paragraph role="listitem" id="par_id3150446" xml-lang="en-US" l10n="U" oldref="16">Type the text that you want to display when the condition is met in the <emph>Then</emph> box. There is no limit to the length of the text that you can enter. If you want, you can even copy and paste a paragraph into this box.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3150473" xml-lang="en-US" l10n="U" oldref="17">Click <emph>Insert</emph>, and then click <emph>Close</emph>.</paragraph>
</listitem>
</list>
<paragraph role="heading" id="hd_id3155073" xml-lang="en-US" level="2" l10n="U" oldref="66">To display the conditional text:</paragraph>
<paragraph role="paragraph" id="par_id3155086" xml-lang="en-US" l10n="U" oldref="67">In this example, the conditional text is displayed when the value of the conditional variable is equal to 3.</paragraph>
<list type="ordered">
<listitem>
<paragraph role="listitem" id="par_id3155110" xml-lang="en-US" l10n="U" oldref="19">Place your cursor in front of the field that you defined in the first part of this example, and then choose <emph>Edit - Fields</emph>.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3155136" xml-lang="en-US" l10n="U" oldref="68">Replace the number in the <emph>Value </emph>box with "3", and then click<emph> Close</emph>.</paragraph>
</listitem>
<listitem>
<paragraph role="listitem" id="par_id3155168" xml-lang="en-US" l10n="U" oldref="20">If the field does not automatically update, press F9.</paragraph>
</listitem>
</list>
<embed href="text/shared/00/00000004.xhp#related"/>
<embed href="text/swriter/guide/fields_userdata.xhp#fields_userdata"/>
<embed href="text/swriter/guide/conditional_text2.xhp#conditional_text2"/>
<paragraph role="paragraph" id="par_id3145714" xml-lang="en-US" l10n="C"><link href="text/swriter/02/14020000.xhp" name="List of conditional operators">List of conditional operators</link></paragraph>
</body>
</helpdocument>