Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Objective

This sample explains the functionality of <forEach/> construct, where, user can implement repetitive tasks. The tasks can be sequential or parallel based on parallel property. So <forEach/> becomes advantageous compared to <while/> or <repeatUntil/>, when the repetitive tasks are paralleled.

Introducing the ForEach Construct

Code Block
languagehtml/xml
<forEachparallel="no"counterName="ForEachCounter">
   <startCounterValue>"1"</startCounterValue>
   <finalCounterValue>"3"</finalCounterValue>
   <scopebpmn:label="ForEach">
      <sequence>
         <assign>
            <copy>
                <from>concat($thisStartRequestMsg.body/text(), $ForEachCounter)</from>
                <to>$thisStartRequestMsg.body</to>
            </copy>
         </assign>
       </sequence>
    </scope>
</forEach>

...

Info
titleNote

<forEach/> can have only one <scope/> child.

Deploying the Sample

WSO2 BPS provides a sample, which can be deployed and executed to understand the ForEach constructs discussed above. Follow the instructions below to deploy and trigger the process.

...