Variable rule
See also: Entity property rule, Variable
Rule type – Abstract
Purpose: Is considered 'passed' if a variable exists in the current data context that matches the corresponding configuration parameters in terms of name and value.
The Variable rule checks whether a Variable exists in the context of the current transaction whose name matches the character string in the Name parameter and whose value (either directly or as a string image) corresponds to the character string in the Value parameter.
►IMPORTANT◄ If the Variable addressed by Name contains a value whose data type is not a String, its string image is compared with the Value. There are data types (enumeration values, date values, etc.) for which a different string image applies depending on the execution context (server/client).
Specific example:
If a status variable contains the value ‘New’ (NEW) from the dynamic enumeration Working state, a variable rule (with the Name status ) is considered to have passed in the server context if the Value NEW (the internal name of the enumeration value) is specified.
In the client context, a Variable rule (with Name status) is only considered to have passed if the Value matches the localisation applicable in the execution context for the enumeration value (here ‘New’ for the Current locale ‘German’).
Regardless of the execution context, the Variable rule cannot distinguish whether the Variable status contains the checked String directly as a value or another value that returns it as a string image.
A Variable rule could also not distinguish whether the enumeration value ‘New’ (NEW) is really a Working state or a value with the same name (server context) or the same localisation (client context) from another enumeration (e.g. Incident status).
Configuration
The Name and Value parameters are required fields of the configuration. Therefore, the Variable rule cannot check variables for 'no value'. |
|
►NOTES◄
The Variable rule is not suitable for inspecting complex objects stored in variables.
However, it is always an option to use a Entity property rule in combination with a Variable resolver instead of using a Variable rule.
The Variable rule can be used in combination with the event action E-Mail to define an association criterion identifying a specific Print document.
Example
In the context of an event handler, a E-Mail action should be replaced by a Show alert (Popup), when the event handler is executed in test mode.
Inside an If then else action, the Variable rule checks for a variable named 'isTest' with a value of 'true' in the context of the transaction.
Although the variable contains a Boolean value (see note below), the Variable rule checks for the string (here 'true').
►NOTE◄ During Tests, variables and their values can be inspected in the 'Variables' tab. The variable 'isTest', which is automatically provided by the system when a test is executed, is featured as follows:
<entry>
<key xsi:type=
"xsd:string"
>isTest</key>
<value xsi:type=
"xsd:boolean"
>
true
</value>
</entry>