Bookshelf Home | Contents | Index | Search | PDF |
Siebel Tools Reference > Special Behavior Supported by Templates > Conditional Tags >
SWE Conditional Tags
The SWE framework supports the following conditional tags.
<swe:if>
Provides a simple conditional branching capability.
<swe:if condition="xxx"> ... </swe:if>
- Condition. The condition to check for. If the condition evaluates to TRUE, the body of the
<swe:if>
tag is processed. If the condition evaluates to FALSE, the body of the tag is skipped.NOTE: This tag does not provide an "else" capability like the if tags in programming languages. To get that behavior use the tags
<swe:switch>
,<swe:case>,
and<swe:default>
described below.<swe:switch>
,<swe:case>
, and<swe:default>
These three tags are used together to provide a conditional branching capability similar to the switch, case, and default statements in JavaScript. The
<swe:switch>
is a container tag for the<swe:case>
and<swe:default>
tags. Anything other than<swe:case>
and <swe:default>
within the body of the<swe:switch>
tag is ignored. The condition to check is specified as an attribute of the<swe:case>
tag. The<swe:case>
tags are checked starting from the first<swe:case>
tag. If any of the<swe:case>
tags satisfies the condition, the other<swe:case>
tags and the<swe:default>
tags are skipped. If none of the <swe:case> tags satisfy their condition, the body of the<swe:default>
tag is processed. There should only be one<swe:default>
tag within the body of a<swe:switch>
tag.
- Condition. Supported only in the
<swe:case>
tag. If the condition evaluates to TRUE, the body of the<swe:case>
tag is processed. Any subsequent<swe:case>
tags within the<swe:switch>
tag is skipped without checking their associated conditions. If the condition evalues to FALSE, the body of the tag is skipped.The SWE framework supports a limited set of conditions that can be checked using the conditional tags. These are described in the following sections.
<swe:if-var>
The
<swe:if-var name="[value]">
tag is used within applet templates to conditionally express its body based on a variable set in a parent view template. When an applet is associated with a view, the applet's template(s) acts as a child of the view's template for the purposes of theswe:if-var
tag. The applet placeholder in the view template must specify a variable for theswe:if-var
tag in the child applet template to evaluate. Theswe:if-var
expression returns true or false depending on whether the variable it is evaluating is a property of the<swe:applet>
tag in the corresponding view template. This construct is useful for conditionally displaying parts of an applet depending on its position within a view.Figure 232 shows a diagram of the relationships.
Consider an example where a view uses a template that contains the following tags:
<swe:applet hintMapType="Applet" id="1" property="FormattedHtml" hintText="Applet" var="Parent"/>
<swe:applet hintMapType="Applet" id="2" property="FormattedHtml" hintText="Applet" var="Child"/>
The view object also references an applet (through a view Web template item) whose template includes the following tags:
<swe:menu type="Button" bitmap="MenuBttn" width="38" height="15" bgcolor="gray" fgcolor="blue"/>
<swe:menu type="Button" bitmap="MenuBttn" width="38" height="15" bgcolor="gray" fgcolor="red"/>
If the user drags and drops the applet into the placeholder in the view template with an id=1, the first
swe:if-var
condition will return TRUE and the second will return FALSE. This is because the<swe:applet>
placeholder with an id=1 has its var property set to "Parent." As a result, the button menu will be displayed with a foreground color of blue. By contrast, if the user had mapped the applet to the placeholder represented by<swe:applet id="2">
, the reverse would be true, and the button menu will be displayed with a foreground color of red.
Bookshelf Home | Contents | Index | Search | PDF |
Siebel Tools Reference Published: 20 October 2003 |