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.


images/download/attachments/201665605/image-2025-3-28_6-59-24-version-1-modificationdate-1743141564953-api-v2.png

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

images/download/attachments/201665605/image-2025-3-28_7-0-32-version-1-modificationdate-1743141632658-api-v2.png

The Name and Value parameters are required fields of the configuration. Therefore, the Variable rule cannot check variables for 'no value'.

  • The static entry for Name must exactly match the name of a variable in the given context. If no such variable exists, the rule fails.

  • The static entry for Value must exactly match the string returned in place of the value of that variable.

    • String variables return their value directly. An empty string is not identical with a null value. The latter cannot be defined as a Value in the rule.

    • When evaluating numeric content, the Value string must resemble the characters stored in the variable's value. A value of '6.00' (big decimal) is not identical with a value of '6' (integer).

    • Boolean values can be validated against strings ('true', 'false').

    • For values of dynamic enumerations, the string of the internal name is returned. For example, Salutation 'Mr' matches a Value of 'MR'.

►NOTES◄

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.

images/download/attachments/201665605/image-2025-3-28_7-3-8-version-1-modificationdate-1743141788281-api-v2.png

  • 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>