Home > WebEOC > Admin Guide > HTML Conventions > Conditional Testing

Conditional Testing

Conditional Testing Based on dataid

Is it a new record?

Data in this tag only shows if there isn't a dataid 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 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 below 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 this 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 this 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, WebEOC Administrator.

<if test="contains(/data/@positionname, 'Admin')">

The data in this tag only shows for the WebEOC 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 and @assigned_to = /data/@positionname">
You must to post a comment.
Last modified

Tags

Classifications

This page has no classifications.