Developer Workflow Guide > Workflows > Sequence Flows
  

Sequence Flows

A sequence flow connects workflow objects to specify the order that the Data Integration Service runs the objects. The editor displays sequence flows as arrows. You can create conditional sequence flows to determine whether the Data Integration Service runs the next object.
You cannot use sequence flows to create loops. Each sequence flow can run one time.
The number of incoming and outgoing sequence flows that an object can have depends on the object type:
Events
A Start event must have a single outgoing sequence flow. An End event must have a single incoming sequence flow.
Tasks
Tasks must have a single incoming sequence flow and a single outgoing sequence flow.
Gateways
Gateways must have either multiple incoming sequence flows or multiple outgoing sequence flows, but not both. Use multiple outgoing sequence flows from a gateway to split a workflow. Use multiple incoming sequence flows to a gateway to merge multiple branches into a single flow.
When you connect objects, the Developer tool gives the sequence flow a default name. The Developer tool names sequence flows using the following format:
<originating object name>_to_<ending object name>
If you create a conditional sequence flow, you might want to rename the sequence flow to indicate the conditional expression. For example, if a conditional sequence flow from a Mapping task to a Command task includes a condition that checks if the Mapping task ran successfully, you might want to rename the sequence flow to MappingSucceeded. You can rename and add a description to a sequence flow in the sequence flow general properties.

Conditional Sequence Flows

Create a conditional sequence flow to determine whether the Data Integration Service runs the next object in the workflow.
A conditional sequence flow includes an expression that the Data Integration Service evaluates to true or false. The expression must return either a boolean or an integer value. If an expression returns an integer value, any non-zero value is the equivalent of true. A value of zero (0) is the equivalent of false.
If the expression evaluates to true, the Data Integration Service runs the next object. If the expression evaluates to false, the Data Integration Service does not run the next object. If you do not specify a condition in a sequence flow, the Data Integration Service runs the next object by default.
When an expression in a conditional sequence flow evaluates to false, the Data Integration Service does not run the next object or any of the subsequent objects in that branch. When you monitor the workflow, the Monitoring tool does not list objects that do not run in the workflow. When a workflow includes objects that do not run, the workflow can still complete successfully.
You cannot create a conditional sequence flow from the Start event to the next object in the workflow or from the last object in the workflow to the End event.

Failed Tasks and Conditional Sequence Flows

By default, the Data Integration Service continues to run subsequent objects in a workflow after a task fails. To stop running subsequent workflow objects after a task fails, use a conditional sequence flow that checks if the previous task succeeds.
You can use a conditional sequence flow to check if a Mapping, Command, Notification, or Human task succeeds. These tasks return an Is Successful general output. The Is Successful output contains true if the task ran successfully, or it contains false if the task failed. Create a boolean workflow variable that captures the Is Successful output returned by a task. Then, create an expression in the outgoing conditional sequence flow that checks if the variable value is true.
For example, you create a boolean workflow variable that captures the Is Successful output returned by a Mapping task. You create the following expression in the conditional sequence flow that connects the Mapping task to the next task in the workflow:
$var:MappingTaskSuccessful = true
If the Mapping task fails, the expression evaluates to false and the Data Integration Service stops running any subsequent workflow objects.

Terminate Events and Conditional Sequence Flows

You can use a conditional sequence flow to connect a task to a Terminate event. If the output from the task satisfies the condition on the sequence flow, the workflow reaches the Terminate event and the workflow ends. A workflow that ends at a Terminate event enters an aborted state.

Parameters and Variables in Conditional Sequence Flows

You can include workflow parameters and variables in an expression for a conditional sequence flow.
You can select a workflow parameter or variable in the Condition tab, or you can type the parameter or variable name in the conditional expression using the required syntax.
For example, you create a workflow variable that captures the number of rows written to the target by a mapping run by a Mapping task. You create the following expression in the conditional sequence flow that connects the Mapping task to a Command task:
$var:TargetRowsMapping > 500
The Data Integration Service runs the Command task if the mapping wrote more than 500 rows to the target.