Associating loop activity instances with different items
In multi-instance loops, you can associate each instance of an activity with a list item.
About this task
To set up the activity instance-item association, the following key settings are required:
- As a prerequisite, you must already have defined a private variable that holds the list of items that you want to iterate through, for example, tw.local.ListofItems. This variable is used in the built-in tw.local.ListofItems.listLength JavaScript function, where .listLength calculates the length of the item list.
- You associate each activity instance with a specific item in the list by using the tw.local.ListofItems[tw.system.step.counter] JavaScript, where [tw.system.step.counter] specifies which item to be retrieved from the list.
Procedure
- In the process diagram, select the activity that you want to configure.
- In the properties, select General.
- Under Behavior, select Multi-instance Loop from the Loop type list.
- Under Multi-instance Loop, enter tw.local.ListofItems.listLength in the Start quantity box.
- On Data Mapping, under Input Mapping, select, or type the following input string: tw.local.ListofItems[tw.system.step.counter]
- For the Ordering and Flow condition settings, refer to steps 5 and 6 in the procedure described earlier.
- Click Save or
Finish
Editing.