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
In this sample, 3 iterations take place based on the values of <startCounterValue/> and <finalCounterValue/>. The property
counterName can be used as a local variable inside the child scope to store current iteration value. In the above example,
ForEachCounter variable value can be 1,2 or 3.
Then, inside <scope/>, repetitive task can be implemented.
<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.
1. Log in into BPS server management console and select "Processes -> Add" under the "Main" menu.
2. Upload the
3. In the "Deployed Processes" window, click the "Process ID" to access its "Process Information" window.
4. Under the "WSDL Details" widget, trigger the process using the "TryIt" link to create an instance of it.