For Each Element in Collection
This component loops through all the elements in a list, allowing you to operate on each element in turn.
[Insert component icon Image file here.]
Definition of component input value or values
|Input Value Name||Input Value Data Type||Req'd||Example Format||Explanation|
|Array Variable Type||Type||Yes||String||The type of data stored in the collection. You must set this before selecting the "Array Variable Name" because this setting is used to filter the list of available variables to only show collections of this type.|
|Array Variable Name||String||Yes||SomeNames||The name of a variable holding the collection of elements to be looped through.|
|Item Output Variable Name||String||Yes||SomeNames||The name of a variable to which each element in the collection named in "Array Variable Name" will be assigned.|
|Show First And Last Paths||Boolean||No||True||If set to true, the component will include a "first element" and a "last element" output path in addition to the "next elment" and "finished" paths. The first path will be followed with the "Item Output Variable Name" assigned to the first element in the collection, the "next element" path will then be followed for the remaining elements except for the last element. The "last element" path will be followed for the last element.|
Notes on usage
This component will only work properly if the path that exits the "first element", "last element" and/or "next element" ultimately returns back to this component. If any of those paths fails to return, the loop will not be re-entered. There are situations where this may be appropriate, however. For example, if you simply need to find a single element in the collection and do not want to use the filter component, the path from "next element" would not return to this component when that element is found.
Definition of component output value or values
The variable named in "Item Output Variable Name" will be assigned to the next element in the collection in turn each time the process flows through this component.
Determine if a Script has been Rerun
One way to use this component would be to determine if a script file has been run again since the last time it was checked and to find the oldest run if it was. In this case, there is an xml file that lists the dates and times that a script has been run but not necessarily in date order. In the image below:
- a maxDate variable is setup (here called Init maxDataDate) from the last date checked.
- Each line in the file is examined in turn using the "For Each Item In Collection" component.
- If the date extracted is greater than the previously noted maximum date, then it is saved
- flow then returns to the "For Each Item In Collection" to fetch the next element in the collection.
[Describe the use case. Insert screen shots or package files. Insert a description of how the settings are configured. Insert additional information about the use case that you are submitting.]