Conditions, Preconditions, Postconditions
You can define conditions, actions and final actions, for each task in a Workflow. Conditions evaluate situations before (preconditions) or after (postconditions) the execution of the task and trigger the actions accordingly.
In IF Workflows, an additional option is available; you configure a condition in its START node that determines which branch (True or False) of the Workflow should be executed and the time at which it should run. The final action RUN PATH ends the evaluation process and starts the True or False branch depending on what you have specified. Conditions in IF Workflows are processed when the Workflow starts, before the subordinate tasks are processed.
You configure conditions in the conditions editor. To access it, right-click the task in the Workflow, select Properties and open the condition pane that you need.
Conditions can include other conditions and actions. The nesting depth is not limited.
After the Workflow has started, you can check the task reports for detailed information about what to expect from the condition configuration.
Notes:
- To be able to use variables in preconditions, those variables must be available for the task. If you have defined variables for the Workflow that you want to use in a precondition in a task, those Workflow variables must be inherited by the task
- Preconditions must include at least a final action. Otherwise, the Workflow cannot start.
Tip: Watch the Video: Conditions in Workflow Tasks
This page includes the following:
The Conditions Editor
You build the logic of your conditions in the conditions editor.
Dialog Header
Displays the name, title (if specified) and path (where it is stored in the Process Assembly perspective) of the Workflow.
Click the icon on the upper right corner to expand the dialog to the complete window size. Click it again to restore it to its original size.
Commands (Left) Pane
Contains three tabs where you can select the conditions, actions and final actions.
The contents of the tabs vary depending on whether you are inserting Preconditions or Postconditions. They are predefined and you cannot change or edit them
Building (Right) Pane
Drag the commands in the left pane to drop them here.
The symbol indicates that the condition or action is processed recurrently. In case of Preconditions, they are repeated until a final action has been reached. For Postconditions, they are processed only once.
If you want the condition or action to be processed only once, click it. It changes to display a 1. This affects to both the current conditions and all its embedded conditions.
ForEach workflows: Whether your Preconditions will be evaluated once or repeatedly for each iteration (loop) depends on what you define here for each task that is part of the relevant workflow.
Structure of Conditions and Actions
Conditions and actions are displayed on the building pane as blocks that group related statements together to form the entire condition. You can embed conditions within conditions, which are also displayed as blocks within blocks.
A condition block starts with IF. You can add multiple conditions that need to be evaluated together. The additional conditions appear in blocks that start with AND IF.
If for some reason the connection cannot be evaluated, it is neither True nor False. In this case, the system keeps evaluating until it gets a result.
Example
IF file '/uc4/temp1/temp2' exists (check via MUNTEST000594_WO122_LX6_01_SYS and use log in LOGIN.OBP.0001). FINALLY run task ELSE FINALLY skip
In this example, the system keeps evaluating until it finds the relevant path. If the file exists, the condition ends with True; otherwise it ends with False.
The first action block of a block starts with THEN, blocks for additional actions for a positive evaluation of a condition begin with AND THEN.
Blocks for the action for a negative evaluation of the condition start with ELSE. Additional ELSE actions start with AND. This allows you to build further AND IF conditions for an ELSE action, to describe another decision branch for an action.
Working with the Conditions Editor
To Add Conditions and Actions
- Select a condition or action from the left pane.
-
Drag and drop it onto the right pane. It is displayed in a block.
The parameters that you have to populate with the data to be evaluated by the condition are highlighted and in capital letters. See To Populate Conditions or Actions .
To Insert Conditions and Actions in Other Conditions
- Select a condition or action from the left pane and drag it to the right pane.
-
Move it across the pane until the block in which you want to include it displays a highlighted line (the color depends on your configuration).
- The embedded condition or action is displayed in a block of its own within the "parent" condition.
To Replace Conditions and Actions
- Select a condition or action from the left pane and drag it to the right pane.
-
Move it across the pane until the condition or action you want to replace is highlighted and REPLACE is displayed over it.
To Deactivate or Remove Existing Condition or Action Blocks
Select the required block and click the Deactivateor Remove button in the upper right corner of the dialog.
Deactivating has the effect that the block will not be processed during the Workflow execution. Deactivated blocks are grayed out. You can activate them again at any time.
To Populate Conditions or Actions
Once you have inserted a condition or action you have to populate it with the values that are going to be evaluated. They are the highlighted terms on the condition editor header. For example, in the screenshot below these are VALUE1, OPERATOR and VALUE2.
- Click any of the values on the header. This expands the block and displays the input or selection fields.
-
You can populate them using either variables or a static value that you enter or select.
To use variables:
- Either hover your mouse over its label or insert your cursor in the corresponding field. This activates the # button that indicates the possibility of using variables.
-
Click it. The field displays now the variable picker icon:
- Click it to open the Insert Variable dialog.
- If all fields are populated and the values are correct, the block is closed and the values are displayed on its header.
- When you are done, click OK to close the dialog.
- Save your changes.
To Copy and Paste Pre and Post Conditions
You can reuse already defined conditions by copying and pasting them both in a different task either within the same Workflow or in an entirely different one. If the copied condition includes nested conditions, they are also copied.
An internal check ensures that you can only paste a condition that is valid in the context of the target task. If it is not, the Paste button is disabled.
- Select the condition you want to copy and click Copy on the toolbar.
- Click OK at the bottom of the editor to leave it.
- Switch to the task into which you want to paste the condition and open the conditions editor there.
-
Do one of the following:
- Click Paste on the toolbar or select it in the dropdown menu.
- If you want to insert it in an already existing condition, select it and click Paste.
- Click OK to leave the editor.
- Save your changes.
See also: