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 Copied 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 job; unless the current job is being called from another job, the variable in question will be reset to its default value. This is to prevent the need to resolve two potentially different values of a Copied 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 Copied to update a Shared prior to the OR, as demonstrated in the second example, below.

Properties

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

Example

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 Copied variable ('partial_rows_loaded') to use later on. This presents an issue, since Copied 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 Copied variable and assign it to a Shared variable, which will not be reset upon hitting the Or component.

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

Now when run, the exported variables are moved to a Shared 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.

Attachments

orcomponent.json