Skip to main content
Nintex Community Menu Bar

There is no detail that answers this question on the Help documentation for the action (here), which is a pity.
 

When using the ‘Add item to a collection’ WF action you must specify an index value, where the index starts at zero. However, if you start with an empty index and after the first item (at ‘0’) add additional items at index values > 0 but that are non-sequential will the collection still hold the values? It seems not. And is this by design or bug?

Hi ​@Bards,

The video embedded in the help file you linked (click the expand button at the top right to see it) explains a range of scenarios at the 1-minute, 10-second mark. All items added to a collection, regardless of the specified index, will be added.


Thanks for the reply. So maybe I’ve identified a bug then. I created a test flow to see what would happen in advance of raising this question: add an item at Index 0 to a empty collection and then add additional items at later positions that are non-sequential (ie. 5, 9, 17). If what the video presents is correct then this is not functioning: additional items that are not in sequence are not being added.

I’ll test again before raising a defect with Nintex.


Hi ​@Bards,

I actually created that video around 2 years ago and tested all those scenarios.
I just tested your scenario and came up with h"number0","number5","number9","number17"].
So, it appears that the scenario where you add an item at an index higher than what is in the current collection behaves as per the video, and that is, the item is added at the next available index.


So, you are of course right. An example of why it’s best to measure twice, cut once - of in this case test twice. Closer inspection of my somewhat convoluted test showed I had an error in my setup which resulted in the incorrect test outcomes I was seeing. I thought maybe it was because I was adding files to a collection rather than text, but no, it was me.

Thanks for the responses - and also highlighting where I can find more info in the Help documentation.


Reply