Or Component

Or Component

The "Or" orchestration component waits for any of its inputs to complete before continuing the job. Once any of the inputs complete, the tasks defined after the "Or" component are added to the job. There may already be tasks in the queue however, so they may not necessarily be run next.

The input links do not have to be success links. For example, you may wish to take an action if any of a set of components fail, regardless of which particular one fails.

Only the Name property can be configured to provide a meaningful description of the component.

For similar flow components, see And Component and If Component.

NOTE: Any local variables that exist in the workflow when going through the Or component will be reset to the values they held at the beginning of the current job (the job containing the Or component in question). This is usually the default value for the variable but is not necessarily so if the job containing the Or component is called from another job. This is to prevent the need to resolve two potentially different values of a local variable when two parallel workflows meet the Or component. If this is not the case for your workflow, consider instead using the value of the local to update a global prior to the OR, as demonstrated in the second example, below.


Property Setting Description
Name Text The descriptive name for the component.


In this example, if any of the loads fail we want to do some cleanup work to ensure when the job ends the database is left in a consistent state. (The details of the Cleanup job are not covered here).

The name can be set to a custom value.

Example 2

In this example, we have a job that branches off to perform one of two possible loads, depending on how large the job is (indicated by a variable named 'branch'). An Or component is used simply to return the branched workflow into a single branch. The job is shown below.

In each load, we want to export the row count into a local variable ('partial_rows_loaded') to use later on. This presents an issue, since local variables are reset to their default value upon the workflow reaching an Or component.

To solve this, we include a Python Script component in each branch of the workflow. These Python Script components take the value in the local variable and assign it to a global variable, which will not be reset upon hitting the Or component.

Note that for this to happen, we must declare the global variable first using the manager (Project → Manage Environment Variables).

Now when run, the exported variables are moved to a global variable that survives passing through the Or component and can be printed.

This job can be downloaded below and imported into your own Matillion ETL instance.