Solved

Need help with Collection variable

  • 8 October 2018
  • 6 replies
  • 56 views

Badge +9

I used a Query List action to get Titles for all items in the list and saved it in a Collection variable. Next I want to do the For Each action and compare the title to items in the different list. It all works as expected on-prem but there is something different with the Collection variable in O365. Here is my Collection variable:

[{"Title":"12-2812"},{"Title":"12-2816"},{"Title":"12-2817"},{"Title":"12-2818"},{"Title":"12-2819"},{"Title":"12-2820"},{"Title":"12-2821"},{"Title":"12-2822"},{"Title":"12-2823"},{"Title":"12-2824"}]

Once I run For Each it seems to return "Title":"12-2812" instead of just 12-2812. How do I get just a value from a collection variable to compare to another list?

icon

Best answer by igorsp 10 October 2018, 20:41

View original

6 replies

Badge +9

Hi Igor,

This guide here https://help.nintex.com/en-US/O365/Default.htm#o365/O365WorkFlow/GettingtoknowNWO/ForEach-CreateWorkflow.htm%3FTocPath%3…  suggests that it should return both the key and the value in different fields (one output for key, one output for value). Which are you logging to get the value there?

Callum

Badge +9

The link talks about a Dictionary variable. Should I be using it instead of the Collection variable for my scenario? I will do some testing to see if it works as expected.

Badge +9

Hi Igor,

Sorry I completely missed that from your original post, however this may be the issue. A Dictionary is comprised of one or more key/value pairs (as your data is), where as a collection is just a collection of items. If you were to use a dictionary variable in this instance, I think it's likely that the For Each should split the key "Title" away from the value "12-2812"

Let me know how you go.

Thanks,

Callum

Badge +9

When using the Query List action in Nintex for O365 the output can only be saved in the Collection variable. So we are back to square one - how do I extract a value from a Collection variable?

Badge +9

So when everything else fails - read the instructions... In O365 there is an option to save output separately for each column. Once you select it everything works as expected!

Badge +9

Glad you found the answer, sorry for the misleading dictionary conversation.

Callum

Reply