Accumulating the Activity Output for All Iterations
When using the Loop tab to iterate over an Activity, you have the option to specify if you want the Loop to output the cumulative data from all iterations. You can do so by setting the Accumulate checkbox to Yes.
When the Accumulate checkbox is set to Yes, the activity accumulates the data from each iteration and outputs that collective data as an array of objects. Here, each object contains the output from the corresponding iteration. The accumulated results are displayed as an array in the downstream activities in the mapper and be available for mapping.
When mapping to an element within an object in the output array of the activity, you must provide the index of the element to which you want to map. For instance, when you click a property within the object under
responseBody, the expression displayed in the mapper is
$activity [<activity-name>] [<<index>>].responseBody.<property-name>
. Replace
<<index>>
with the actual index of the object to whose property that you want to map.
When the
Accumulate checkbox is not selected, the output of the Loop displays an object that contains only the data from the last iteration. Data from all previous iterations is ignored. When mapping to an element in the output object of the activity, when you click a property within the object under
responseBody, the expression displayed in the mapper is
$activity [<activity-name>].responseBody.<property-name>
.
The Output tab of the activity changes based on your selection of the Accumulate checkbox. The parent element (the name of the activity and the data type of the iteration output) is displayed regardless of your selection. If you set the Accumulate checkbox to Yes, the data type of the parent element is an array of objects. If you did not select the checkbox, the data type of the parent element is an object. The Output tab contents are also available in the mapper allowing for the downstream activities to map to them.