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

  • 4 August 2017
  • 4 replies
  • 6 views

Badge

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.


4 replies

Userlevel 5
Badge +14

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.

Badge +3

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?

Badge +3

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

Badge +3

got it sorted guys all good

Reply