cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

Create collection or dictionary from Multiple selection

Jump to solution

Hi,

I have a field where I can have multiple selections.

GED_1.1_MultipleChoice.png

In the workflow it gives me a string as result of the selections:

{"results":[{"Id":70,"Value":"DR - ALSACE FRANCHE-COMTE"},{"Id":72,"Value":"DR - BRETAGNE"},{"Id":76,"Value":"DR - COTE D'AZUR"}]}

What would be the best way to convert this value "{"results":[{"Id":70....." in a collection or dicitionary? I can manipulate the string to do it but it would be good to have an action for this.

Thanks

Tags (2)
Reply
3 Replies
Not applicable

Re: Create collection or dictionary from Multiple selection

Jump to solution

Many of these interactions between forms and workflows require some ugly data mangling to make it work at the moment. Sadly there is no consistent, clean API that deals with multiple values and/or lookup items (where IDs appear in the data).

So, what you'll probably need to do is use a Regular expression action to clean any "surrounding junk" (prefixes and suffixes) from the data string, leaving you with something that is in the form:

data1<delimiter string>data2<delimiter string>data3     (and so on)

and then use the "Split" collection operation to split the data values into a collection. Note the Split operation allows regular expressions as delimiters, so there is enough flexibility to deal with varying IDs etc. between the data values. This is well described in this article by Vadim Tabakman.

I'm not sure if this could be packaged as a User-Defined Action (UDA), effectively giving you a "subroutine" that takes a multi-select choice field value and returns a collection. If it is, please post the result!

0 Kudos
Reply
Workflow Hero

Re: Create collection or dictionary from Multiple selection

Jump to solution

Comprehensive answer for you here

0 Kudos
Reply
Workflow Hero

Re: Create collection or dictionary from Multiple selection

Jump to solution

The answer is It's both. The result is in a dictionary who's tag is "results". Put the value in a dictionary variable then go get the collection value that is within. In your case you have a third thing going on here because the ID and Value is in play. So once you have a collection variable you then can get each item of the collection using the action by that name, or a For Each loop. In both cases, you need to store the each item of the collection into another dictionary variable. At this point you can then get the dictionary items using the keys ID and Value.

0 Kudos
Reply