Route Expressions with Switch Action Branches

You can define switch action branches to add routing expressions in your integration. The switch action takes the first branch that evaluates to true. The other branches are ignored. A switch is essentially single-threaded.

  1. Add a switch action to an integration in either of the following ways:

    • On the right side of the canvas, click Actions Integration actions icon and drag the Switch action to the appropriate location.
    • Click Add icon at the location where you want to add the switch action, then select Switch.

    Note:

    Nested switches are supported.

    Two branches are automatically created:


    Switch action with Route 1 and Otherwise branches.

    • Route 1 (first) branch: You must define a routing expression for this branch.

    • Otherwise (second) branch: This branch is taken if the routing expression for the initial branch does not resolve to true.

    Note:

    To add more branches, click Actions Actions icon in the switch action, then Add.
  2. From the Route 1 branch icon, double-click the branch or click Actions Actions icon, then Edit.

    The Configure Route panel opens. This includes a Sources tree of elements.

    You can now define different data flows for both the defined and otherwise branches in the switch action.

  3. Click Edit Edit icon under Configure Route to enter a name for the Route 1 branch.

  4. Define a routing expression. For this example:
    • filetype is dragged to the upper Value field
    • = is selected as the operator
    • 'json' is manually entered in the lower Value field. You can also drag a value from the Sources tree or select a value from the drop-down list.

    The Sources tree of elements is shown on the left side. The Configure Route section is shown on the right side. Under this section are the Enter name field, the values that show the complete routing expression, and the Value field, Operator list, and Value field that show the individual parts of the routing expression. Both Value fields include icons for clear and switch to developer view.

    You can add functions to your expression under the Functions tab. XPath version 2.0 functions are supported. Base 64 encode and decode functions that process data confidentially across layers and functions that return boolean results are also supported. Functions that return nonboolean values are not supported.

  5. Click Switch to Developer Mode Switch view icon to view the complete path name.


    The Value field, Operator list, and Value fields are shown. Both Value fields include icons for clear and switch to developer view.

  6. Click Add condition to add more conditions or Add group to add group conditions, when needed.
  7. Click Save.

    For this example, the following expression is defined:


    The Sources tree of elements is shown on the left side. The Configure Route section is shown on the right side. Under this is the Enter Name field and the complete routing expression: filetype = 'json'.

  8. Drag other actions and invokes into the branches of the switch action, when required by your integration. For this example, two switch action branches are defined.


    The expanded switch action is shown with Route 1 and Otherwise branches. Each branch is expanded to show its contents. On the far right, the switch action goes to a stage file action.

Related Documentation
The following sections provide examples of using a switch action in an integration: