Configuring Siebel eBusiness Applications > Specialized Behavior Supported by Web Templates > Favorites (Predefined Queries) >

Conditional Tag: <swe:if-var>


Purpose: 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 templates act as a child of the view's template for the purposes of the swe:if-var tag. The applet placeholder in the view template must specify a variable for the swe:if-var tag in the child applet template to evaluate. The swe: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 133 shows a diagram of the relationships among objects and template files.

Figure 133.  Object Relationships
Click for full size image

Usage: 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:if-var name="Parent">

<td valign="middle" nowrap>

<swe:menu type="Button" bitmap="MenuBttn" width="38" height="15" bgcolor="gray" fgcolor="blue"/>

</td>

</swe:if-var>

<swe:if-var name="Child">

<td valign="middle" nowrap>

<swe:menu type="Button" bitmap="MenuBttn" width="38" height="15" bgcolor="gray" fgcolor="red"/>

</td>

</swe:if-var>

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.

Configuring Siebel eBusiness Applications