Solved

How do I return multiple values I can loop thru?

  • 24 April 2018
  • 1 reply
  • 7 views

Badge +3

For me this seems to be a very simple lookup, but I can't get useful return values. Here is what I have:

I have a sharepoint list named 'Person'. It is a simple list containing a "Person or Group" field and a field called "Group tags" which is a multiple value field. In my workflow I want to retrieve the Group tags of a person. So I create a workflow variable "wvTagList" that is set to a List Lookup of current item's Group Tags field.

For one document this returns: {"results":[{"Id":3,"Value":"Brabrand"},{"Id":2,"Value":"Office"}]}

For me this looks like a dictionary, containing a collection of 2 dictionaries! Now, I want to loop through the values in the dictionaries in the collection, but I can't get figure out to make the correct for each loop. I want to do a loop a la this:

for each "Value" in "results" collection

     do something with "Value" (i.e. "Brabrand" then "Office")

loop

 

wvTagList is a collection variable.

 

Help is much appreciated

 

/Thomas

icon

Best answer by tcl 24 April 2018, 17:47

View original

1 reply

Badge +3

Well, I figured it out

It was easier than I thought - I got the item name wrong, it appears I should've just used the name 'results', i.e. without parentheses, quotation marks, slashes and what else I thought was necessary

First, use "get an item from a dictionary" action to get the results dictionary of 'outerDict' into collection wvTagList.

Get an item from dictionary (outer) into a collection

Then in the "for each" action loop thru wvTagList and output each dictionary in that collection into dictionary workflow variable dictionaryItem. 

For Each - Loop thru collection

Finally, within the for each loop structure use "get an item from dictionary" to get the Value part of the dictionaryItem into text variable 'tag'.

Get an item from each dictionary in collection

I hope this might help someone else

Reply