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.listLengthJavaScript function, where.listLengthcalculates 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.
- Expand Loop and select Multi-instance Loop from the Loop type list.
- Enter
tw.local.ListofItems.listLengthin 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. For details about declaring variables for the client-side human services, see Declaring variables
This topic is shared by BAW, CP4BA, CP4BASaaS. Last updated on 2025-03-13 12:15