Conditions can be used for defining dependencies in a composition. For example, if a parameter needs to be displayed based on the value selected for another parameter or a composition needs to be applied based on a set of conditions. Conditions are of the following types:
The order in which conditions are defined is important because only a condition defined later can use conditions defined before it. This is to avoid cyclical reference. For example, you have defined Global condition “MEO” first followed by condition “SmallMeter”. The “SmallMeter” condition can use “MEO” as a Parameter condition, but the “MEO” condition cannot use the “SmallMeter” condition (shown in Example 1 below).
Before going through details about the types of conditions, it is important to understand operators that can be used to define conditions. The section below provides details of the different types of operators.
Conditions can be defined with the help of operators. Operators are of two types:
Operator |
Used for Comparing Values of Data Types... |
---|---|
IsEqualTo |
Boolean, String and Integer |
IsNotEqualTo |
Boolean |
IsGreaterThan |
Integer |
IsGreaterThanOrEqualTo |
|
IsLessThan |
|
IsLessThanOrEqualTo |
|
StartsWith |
String |
EndsWith |
|
Contains |
Global conditions are conditions that need to be used frequently within an XML template. They are defined once and can be used anywhere within an XML template to incorporate parameter dependencies or selection of a composition. Global conditions can also be used:
They may include nested Parameter as well as Composite conditions (shown in Example 2 below).
Global conditions are defined using the GlobalCondition element, which comprises the following attributes:
Attribute |
Description |
---|---|
Name |
User friendly name for the condition, which needs to be unique. |
Example
In this example, the Global condition “Show_LabelPadding” is met when the one of the predefined Global conditions in the Composite condition is met.
Example
This example shows a nested condition that can be used to evaluate a Global condition.
Parameter conditions can be used in a composition within the Prerequisite element to determine the composition that will be selected based on user input and to toggle visibility of a parameter. Parameter conditions are also used to define Global conditions. The attributes of a Parameter condition include:
Attribute |
Description |
---|---|
Name |
User friendly name for the condition, which needs to be unique. |
Value |
Expected value of the parameter against which the condition will be evaluated. |
Example
Composite conditions are conditions that are joined together with the AND or OR operator and function as a group. Composite conditions can be made up of Global or Parameter conditions.
Attribute |
Description |
---|---|
Operator |
This can be set to “AND” or “OR” and determines how the conditions needs to be evaluated. |
Example
In the sample code, two parameter conditions are joined together using the AND operator.
See Also
Published June 2018