Conditional Testing
Is it a new record?
Data in this tag only shows if a dataid does not exist in the underlying xml. If you place this around a form element, such as text, textarea, or checkbox, the field has a NULL value when the form is submitted.
<if test="not(/data/node()[@dataid])"> </if>
The data in this tag only shows if there is a dataid in the xml of the page.
<if test="(/data/node()[@dataid])">
</if>
Examples
The following code grabs the username from xml. With the <attribute> tag, the value is set for originating_user with the username if the record is new.
<input type="text" size="20" name="originating_user">
<if test="not(/data/node()[@dataid])">
<attribute name="value"><value-of select='/data/@username'/></attribute>
</if>
</input>
The following code does the same action, but only if the record is an existing record.
<input type="text" size="20" name="updating_user">
<if test="(/data/node()[@dataid])">
<attribute name="value"><value-of select='/data/@username'/></attribute>
</if>
</input>
Conditional Testing Based on groupmembership
Is your position in the right group to see this?
To test for a group and whether it contains a string, use:
<grouplist />
Using the <if> tag
The data in the <if> tag only shows for positions that are part of groups containing the value of the text1 field or AdminGroup string somewhere in their name.
<if test="/data/groups[contains(@name,current()/@text1)] or contains(/data/groups/@name, 'AdminGroup') ">
Using the <choose> tag
The data in the <choose> tag only shows if the positions are part of the Admin group or groups that start with Chief.
<choose>
<when test="/data/groups/@name = 'Admins' or starts-with(/data/groups/@name, 'Chief')">
</when>
The data in this tag is what all others see.
<otherwise>
</otherwise>
</choose>
Conditional Testing Based on positionname
Are you the right position to see this?
Single Criteria
The data in this tag only shows for users that have logged in with a position name containing the word Admin; for example, Unified Command Platform Administrator.
<if test="contains(/data/@positionname, 'Admin')">
The data in this tag only shows for the Unified Command Platform Administrator.
<if test="/data/@positionname='WebEOC Administrator'">
Multiple Criteria
The data in this tag will show if the position name contains CMD, if the field named originating_position is the same as the position name that is viewing the record, or if the assigned_to field is the same as the position name.
<if test="contains(/data/@positionname, 'CMD') or @originating_position = /data/@positionname or @assigned_to = /data/@positionname">
The data in this tag will show if the field named originating_position is the same as the position name that is viewing the record and the assigned_to field is the same as the position name.
<if test="@originating_position = /data/@positionname
<if test="@originating_position = /data/@positionname and @assigned_to = /data/@positionname"