Add a Run In Parallel Action

The Run In Parallel action is used to run multiple code blocks in parallel, and you can also use this action to wait for their results in order to produce a combined result.

Use 1: Run Multiple Action Chains in Parallel

To use a Run In Parallel action to just run multiple action chains in parallel:

  1. Add the action in one of three ways, depending on your preference and where you want it added:
    • Drag the action from the Actions palette onto the canvas, dropping the action either at the bottom edge of the action it is to follow, or at the top edge of the action it is to precede.
    • Double-click the action in the Actions palette to add it to an empty canvas or to the end of an action chain.
    • On the canvas, select the action you want the new action to follow, then double-click the new action in the Actions palette.
  2. Drop the actions to run for each block in the Add Actions area of the Run in Parallel action. For example, you could make two REST calls and assignments in parallel:

  3. To add another block of code to run in parallel, drag the first action for the block from the Action's palette onto a Create Block area that appears at the bottom of the action's blocks:

Use 2: Run Multiple Action Chains in Parallel to Produce a Combined Result

To use a Run In Parallel action to produce a combined outcome from the results of multiple action chains:

  1. Add the Run in Parallel action in one of three ways, depending on your preference and where you want it added:
    • Drag the action from the Actions palette onto the canvas, dropping the action either at the bottom edge of the action it is to follow, or at the top edge of the action it is to precede.
    • Double-click the action in the Actions palette to add it to an empty canvas or to the end of an action chain.
    • On the canvas, select the action you want the new action to follow, then double-click the new action in the Actions palette.
  2. For the Store Result In property, provide a name for the array that will hold the result from each block. The first block's result is stored at index 0, the second block's result is stored at index 1, and so on.

  3. Drop the actions to run for each block in the Add Action area of the Run in Parallel action.
  4. To add another block of code to run in parallel, drag the first action for the block from the Action's palette onto a Create Block area that appears at the bottom of the Run in Parallel action's blocks when you drag an action over it.
  5. Drop a Return action at the end of each block to return its result in the array that was named using the action's Store Result In property:

    An array is returned by the Run in Parallel action (empInfo for this example, set in step 2): the first element contains the first block's result, the second contains the second block's result, and the third contains the third block's result.

For API information about this action, see Run in Parallel in the Oracle Visual Builder Page Model Reference.