Creating and Using Conditions
The Condition
component enables you to model branches in processes, where each execution branch must contain at least one condition.
To model case distinctions, you can define conditions based on:
the execution status of previously executed process components
parameters (global, system or project parameters)
context variables
All set conditions are evaluated during process runtime by the X4 ESB Server's Process Engine.
If you did not set a condition for an execution branch, it will be always executed. This will be indicated by a semi-transparent Condition
component. If multiple conditions apply, all matching branches will be executed according to their priority.
Prerequisites
To use the Condition
component in Technical Process properly, the following prerequisites must be met:
The
Condition
component must have at least two execution branches.Execution branches may not be totally empty. At least one execution branch must contain a process component.
For each execution branch, at least one condition must be defined that is explicit and valid.
The
Condition
component should not be placed inside a fork/join construct.
Inserting a Condition Component
To insert a Condition
component into a Technical Process, perform the following steps:
From the palette, insert a
Condition
componentinto the process via drag-and-drop.
Create a transition from the preceding process component to the
Condition
component, and repeat this for each execution branch.Double-click the
Condition
component or an execution branch to open the Condition Editor.In the Condition Editor, define the conditions for each execution branch.
Thus, click on a transition behind theCondition
component to select an execution branch. The selected transition will be highlighted red. In the Condition area, you can now define evaluation criteria (based on the execution status, based on system placeholders or custom placeholders, or based on context variables, see below).Each condition can contain multiple condition elements that can be combined/cascaded using logical operators (
AND,
OR
, andNOT
). Additional condition elements can be inserted using the corresponding buttons.Click Close to save the conditions.
ATTENTION: Unexpected Process Engine behavior!
If you define a loop within another loop that contains a Fork
/Join
construct, the X4 Server cannot reset the status of the already executed process actions correctly.
To avoid this, put the inner loop with all its process components into a subprocess instead. For more information, see Subprocess.
Defining Conditions Based on the Execution Status
Condition
components enable you to define one or multiple conditions based on the execution status of previously executed process components. As an example, you could evaluate if an Iterator adapter does no longer output data which means that the process execution is redirected to a Stop
component and will, thus, be ended.
To define a condition based on the execution status, perform the following steps:
In the Condition Editor, click a transition line after the
Condition
component to select an execution branch.In Edit Condition, select the process component whose execution status should be evaluated during process runtime.
Only preceding process components can be selected. As an alternative, you can click the corresponding component in the process diagram preview.Select a comparison operator (e.g.
<
,=
), and specify any integer number as comparison value to be evaluated, e.g.1 (ok)
.
If required, you can combine/cascade conditions using logical operators (AND
,OR
, andNOT
).Click Close to save the condition.
Defining Conditions Based on System Parameters
Condition
components enable you to alter process execution based on actual environment parameters. By evaluating system parameters such as %CURRENT_PROJECT%
, you can retrieve actual values during process runtime, see (7.4.0-en) Overview of System Parameters.
To define a condition based on a parameter, perform the following steps:
In the Condition Editor, click a transition line after the
Condition
component to select an execution branch.In the drop-down list on the left-hand side, choose Parameters to open a list below containing all available parameters and parameter groups.
Select a parameter to be evaluated during process runtime, e.g.
CURRENT_PROJECT
.Select one of the following comparison operators:
=
equal to …!=
not equal to …contains
contains …startsWith
starts with …endsWith
ends width …
Enter any alphanumeric comparison value to be evaluated, e.g.
MyProject
.
If required, you can combine/cascade conditions using logical operators (AND
,OR
, andNOT
).Click Close to save the condition.
Defining Conditions Based on Global or Project Parameters
With the Condition
components, you can use global or project parameters for the definition of conditions under certain circumstances. Just like system parameters, global or project parameters allow you to alter process execution based on actual environment parameters.
In order to use global or project parameters in conditions in the Condition Editor and to be able to evaluate them at process runtime, you basically proceed as when defining conditions with system parameters.
Defining Conditions Using Global Parameters
Please note the following additional prerequisites for global parameters:
The global parameter must have already been defined within the Global Parameter Configuration in order to be available in the Condition Editor. For more information, see (7.4.0-en) Global Parameters and Groups.
The global parameter must also be available in the Global Parameter Configuration during process runtime, in order to be evaluated by X4 ESB Server's Process Engine.
In process property
Placeholder Groups
, the corresponding parameter group must have been selected. For more information, see (7.4.0-en) Global Parameters and Groups.
Defining Conditions Using Project Parameters
Please note the following additional prerequisites for project parameters:
The project parameter must already be defined in the file with the Project Parameter Configuration
*.param
in the project in order to be selected in the Condition Editor. For more information, see Set project-specific parameters.Custom Types and Custom Type Values can be used to define selection options for use in the Condition Editor. For more information, see Create custom types.
Use Case for Project Parameters with Custom Types
The Custom Type Environment
has the Custom Type Values Dev
, Test
, Prod
and the Display Names Dev
, Test
, Prod
:

The Values can then be selected in the Condition Editor:

Defining Conditions Based on Context Variables
Condition
components enable you to alter process execution based on actual context variable values.
To define a condition based on a context variable, perform the following steps:
In the Condition Editor, click a transition line after the
Condition
component to select an execution branch.In the drop-down list on the left-hand side, choose Variables, to open a list below containing all context variables that were already defined in the process diagram.
Select a context variable to be evaluated during process runtime, e.g.
MyVar
.Select one of the following comparison operators:
=
equal to …!=
not equal to …contains
contains …startsWith
starts with …endsWith
ends width …
Enter any alphanumeric comparison value to be evaluated, e.g.
1
.
If required, you can combine/cascade conditions using logical operators (AND
,OR
, andNOT
).Click Close to save the condition.