cancel
Showing results for 
Search instead for 
Did you mean: 
bjcathcart
Nintex Newbie

How to loop through a collection variable and set each as a distinct variable? (Nintex 2013)

Jump to solution

I understand how to bundle values into a collection variable, but what about the reverse? At a certain point in one of my workflows I have several values set in a collection variable that I would then like to loop through, setting each as an individual variable.

For example, let's say I have the following workflow variables:

colCurrency (with three values stored), and varCurrency1, varCurrency2, varCurrency3

I simply want to cycle through colCurrency automatically (and with as few steps as possible) to dynamically set each value in the collection equal to a separate varCurrency variable. As you can imagine, I ask because I am working with many more fields than the example. I am using Nintex 2013, and so Set Variable can only be used for a single variable at a time.

Reply
4 Replies
Automation Master
Automation Master

Re: How to loop through a collection variable and set each as a distinct variable? (Nintex 2013)

Jump to solution

do you really need stored all the collection elements into separate scalar variables at the same time?

are you sure about upper bound on number of elements you might get into collection?

if really so, the only option is to sue switch action and let it switch by loop index value. so you need as many switch branches as upper bound on number of elements. with every different index value you go down different branch and save current collection element into different variable.

however, single collection elements are usually processed directly within the loop, one at a time. no need for plenty of variables.

Reply
stevena_jhg
Nintex Newbie

Re: How to loop through a collection variable and set each as a distinct variable? (Nintex 2013)

Jump to solution

Hi am looking at utilizing a loop to gather results in a dictionary (for attachment urls), I have an "update list value" action in there but it overwrites it each time it goes throught the loop. Is there a way to "Amend" to a list value or should I use a switch action for this?

0 Kudos
Reply
stevena_jhg
Nintex Newbie

Re: How to loop through a collection variable and set each as a distinct variable? (Nintex 2013)

Jump to solution

i.e. this article:   but currently it overwrites the list item every time it goes through the loop.

0 Kudos
Reply
stevena_jhg
Nintex Newbie

Re: How to loop through a collection variable and set each as a distinct variable? (Nintex 2013)

Jump to solution

got it sorted guys all good

0 Kudos
Reply