Collections
Definition: A variable containing multiple items, such as email addresses.
Collection variables are useful for storing and operating on query results. For example, you can set up collection variables for names, email addresses and index values to store results from querying a list. You can then loop through items in a particular collection variable (names, emails or index values).
For a more detailed explanation of each collection action, follow the Nintex Workflow help documentation:
https://help.nintex.com/en-us/nwc/Content/Designer/Actions/Collection-actions.htm
Collection variable items start with an index of 0, separated by a delimiter of a coma (,), enclosed within inverted comes(“ “) and the whole collection is within brackets (n ]).

Creating a collection
Select the Variables tab at the top panel.

Give the collection a Name and select Type as Collection then select Create.

Add Item(s) to Collection
- Add an item to a Collection
On the left-side search bar, find the Add item to collection action, and add it to the workflow.

Target collection – Select the collection that an item will be added to.
Index – Type the index number position that the item will be. Index 0 means the item will be the first in collection, index 1 will mean the item will be the second in the collection etc.
Value – Type the value item of your choice.
Output – Select the same collection you selected in Target Collection to save the input value to.


There is also the option of setting the index to -1, this will however move the first item added to the collection to the back, meaning it gets moved up the collection.
The output - Collections o“2”, “1”]
-
Add items from another collection
Items from a multiple selection will be stored as a collection.

Selection input.

Selection Output is stored as a collection.
A loop for each action will be utilized to loop through the multiple-choice collection and add the items to another collection.

Target collection – the collection that will be looped through to get its items.
Data Type – what type of data does the collection have stored.
Add an Add item action to the collection within the loop.

Target Selection – Select the collection that items will be added to.
Index – Select the index of the item that will be added to the new collection from the loop for each action.

Value – Select current item as the value to add to the collection

Check if item exits in collection
Checks if an item exits in a collection, it will return a Boolean value (Yes or No), if it is true, it will return the index of the value that exists in the collection.


Clear Collection
Clear Collection action removes all stored item values within the collection. Leaving the collection with no items.


Count items in a Collection
The actions count the number of item values in a collection and return the total number of items as an integer value.


Get Item from Collection
The action retrieves an item value from the collection based on the index input and will store the value in a variable. The variable type is dependent on the type of value you are retrieving.
-
e.g. - if it is a number (35) then an integer variable will be used to store it.


Join Items in Collection
Joins items in a collection into one string. Specify the delimiter that will separate them then create a text variable that the string item will be saved to.


Output:

Merge Collections
-
Allows up to 10 collections to merged and create one single object.
-
When adding a Collection, stipulate the collection type (which type of items, the collections have).
-
e.g. text, integer, Boolean.
-
-
Stipulate property name that can help you identify item variables.
-
e.g. Contacts, Location.
-
-
After adding the collections, create a variable name for the object that the merged collections will be stored in.
For a more thorough explanation, refer to this link:
https://www.youtube.com/watch?v=HrgBwstmrgA


Remove Duplicates from Collection
Will remove all duplicates from the item values stored in the collection.
Select the collection variable and select the same collection variable as output to store the new collection into.


Remove item from collection
Removes an item value based on its index from the collection, then stores the new collection to the same collection variable.


Remove value from collection
Removes an item value from the collection, then stores the new collection to the same collection variable.


Sort items in collection
Sorts items in a collection based on the sort direction( ascending or descending) then stores new sorted items in the same collection variable.


Split last item from collection
The last value item in a collection will be trimmed, Value of last item will save the trimmed variable and then save the new trimmed collection to the same variable collection.

Collection before being split:


Collection after being trimmed:
