6.8 Setting a Boolean decider
Whenever the XML allows a Boolean decider (instead of a concrete Boolean), these are the valid options:
- A comparison operation between two values
- A logical operation (OR or AND)
- A concrete boolean value (either true or false) inside the parent element
To set a Boolean comparison operation to compare dates or strings
- Locate the UI component to hold the comparison operation.
- Set the <requirement> element with the comparison attribute set to one of the following:
Option |
Description |
"equal"
|
Evaluates to true only if the first and second values are equal |
"lessthan"
|
Evaluates to true only if the first is less than the second |
"greaterthan"
|
Evaluates to true only if the first is greater than the second |
"not"
|
Evaluates to true only if the first is NOT equal to the second |
- Specify whether this is a string or a date by setting the type attribute of <comparison> to either "string" or "date". Not setting type causes Viewpoint to assume "string".
- Set the <first> and <second> elements within <requirement> to the values to be compared. These can be deciders themselves.
- If the type is set to "string", the values should be string deciders.
- If the type is set to "date", the values should be date deciders.
<requirement comparison="equals">
<first>
<component id="procs" />
</first>
<second>1</second>
</requirement>
The requirement evaluates to true if the value in the "procs" component is equal to 1.
To set a boolean decider to perform a logical operation
- Locate the UI component to hold the comparison operation.
- Set the <requirement> element with the logical-operation attribute set to one of the following:
- "or" – Performs a logical OR operation. If any child element evaluates to true, the operation evaluates to true.
- "and" – Performs a logical AND operation. If all child elements evaluate to true, the operation evaluates to true.
<requirement logical-operation="or">
<value>
<component id="test_vlan" />
</value>
<value>
<component id="dev_vlan" />
</value>
</requirement>
The requirement is evaluated to true if either the "test_vlan" or "dev_vlan" components are true.
Related topics