<if>
Mechanism for conditional processing. Use the <if> tag to evaluate Boolean expressions and alter the presentation based on the result. If the test is true, the contents of the tag are displayed. If false, the contents are omitted.
The <if> tag maps directly to an XSL. Set the test attribute to conduct the test you want to perform. The contents should be the output that results if the test is true. Use @ in front of field names. Any Unified Command Platform field referenced in the <if> statement must have a corresponding <eocfield> tag somewhere in the view.
| Attribute | Allowed Values | Requirements | Description |
|---|---|---|---|
| test | CDATA | Required | XSL conditional statement; field names are prefixed with @ and must exist as <eocfield> tags in the view. |
Tips
-
Preface field names with the @ symbol.
-
Enclose string literals in single quotes (apostrophes).
-
Any Unified Command Platform field referenced in the <if> statement must have a corresponding <eocfield> tag somewhere on the view.
Examples
<td>
<attribute name="bgcolor">
<if test="@overdue='true'">red</if>
<if test="@overdue='false'">green</if>
</attribute>
</td>
To see if the field priority is present or has a value, use 'and' and 'or' as in the example below.
<if test="@priority and @priority != ''">No Priority is set</if>
To test the value of an input field, called Status, and show a message if the value is Open, use the formatting seen in the example below.
<if test="/data/node()/@status='Open'">This shelter is OPEN</if>
To suppress the output of a field but still have it available for <if> test statements:
<if test="1=0"><eocfield name="overdue" /></if>