Collection Operation – Nintex

Every time I work with the collection variable, I am in dilemma as to which method to use in collection operation, which method would best handle my situation/get data from the collection one at a time. So, here is a little demonstration of the collection operation’s methods.

The collection operation expects a target collection to operate upon. Let’s have a work flow variable of collection type – CollCountry_WFV (I prefer to have the names of my variables  prefixed by type of workflow variable (i.e. Coll for collection)  and suffixed with the text “WFV” to denote it’s a Work Flow Variable )

CollCountry_WFV = USA;Europe;UK;

Coll1

Methods

Add – Adds a value to a collection at a particular index

Target Collection – USA;Europe;UK;
Value – NewCountry
Index – 0
Resultant CollectionNewCountry;USA;Europe;UK;

Target Collection – USA;Europe;UK;
Value – NewCountry
Index – 1
Resultant Collection – USA;NewCountry;Europe;UK;

Remove – Removes a value from a collection at a particular index

Target Collection – USA;Europe;UK;
Index – 0
Resultant Collection – Europe;UK;

Target Collection – USA;Europe;UK;
Index – 1
Resultant Collection – USA;UK;

Count – Returns the number of items in a collection

Target Collection – USA;Europe;UK;
Result – 3

Get – Gets a value at a particular index

Target Collection – USA;Europe;UK;
Index – 0
Resultant Collection – USA;Europe;UK;
Result – USA

Target Collection – USA;Europe;UK;
Index – 1
Resultant Collection – USA;Europe;UK;
Result – Europe

Exists – Returns the index of an item in collection provided the value you enter is part of the collection, else returns nothing.

Target Collection – USA;Europe;UK;
Value – USA
Result – 0

Target Collection – USA;Europe;UK;
Value – Europe
Result – 1

Target Collection – USA;Europe;UK;
Value – India
Result –

Sort – Sorts the collection in either ascending or descending order

Target Collection – USA;Europe;UK;
Order – Ascending
Resultant Collection – Europe;UK;USA;

Target Collection – USA;Europe;UK;
Order – Descending
Resultant Collection – USA;UK;Europe;

Pop – Pops the value off the end of the collection into a variable

Target Collection – USA;Europe;UK;
Resultant Coll – USA;Europe;
Result – UK

Target Collection – USA;Europe;
Resultant Coll – USA;
Result – Europe

Join – Join all the values in a collection with a delimiter and stores it in a variable(other than of collection type)

Target Collection – USA;Europe;UK;
Delimiter – ”
Result (single line of text) – USA”Europe”UK

Target Collection – USA;Europe;UK;
Delimiter – :
Result (single line of text) – USA:Europe:UK

Clear – Clears off the collection

Target Collection – USA;Europe;UK;
Result – Blank

Remove Duplicate – Removes all duplicate values from the collection

Target Coll – Apple;Apple;Nokia;
Resultant Collection – Apple;Nokia;

Remove Item by Value – Removes the specified item from the collection provided the item exists, else does nothing

Target Collection – USA;Europe;UK;
Value – USA
Resultant Collection – Europe;UK;

Target Collection – USA;Europe;UK;
Value – UK
Resultant Collection – USA;Europe;

Target Collection – USA;Europe;UK;
Value – India
Resultant Collection – USA;Europe;UK;

Happy Nintexing 🙂

Advertisements

4 thoughts on “Collection Operation – Nintex

  1. Thanks for this! Hugely helpful quick question. If I have a variable that is a list of user names. How can I move them to a collection variable and have them split? For instance. I have user1;user2;user3 in a txt variable. whenever I try to add that to a collection variable, it adds it as one item in the collection (Index 0) is there a way to split them into separate indexes?

    Thanks in advance!

    • Hey Andy,

      Let’s say your variable is txtUsers = user1;user2;user3

      Use a Regular Expression action. Select operation as split with pattern “;”. Input text will be txtUsers and store the result in your collection variable.

      You can log the variable to see after that. This will add all items in the collection in separate indexes.

  2. Notably, this post is correct regarding the “EXISTS” collection operation, that it returns a numeric value. Nintex Workflows contextual help shows that it returns a BOOLEAN, this is incorrect;

    For those who lost days because of this Type-O; send Nintex and email 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s