I have a multi-value token, let's say ["Bob", "Jack", "Max", "Aaron"]. Those values are just examples, and will change every time.
I need to find the index of a specific value in this multi-value token. For example, for "Max", I need it to return 2 (starting from 0).
Is there an easy way to do this, or do I have to iterate through the token (either via a script or using For Each Value) and figure it out manually? I looked at the available functions in the token editor but couldn't find anything useful there.
EDIT: I should add some context to this...
I'm making a web request and receiving a JSON response. One item in the JSON structure is an array, like this:
metadata = [ { "field_name": "Name", "field_value": "Bob" }, { "field_name": "Date of Birth", "field_value": "11/20/1978" }, { "field_name": "Has disability", "field_value": "No" } ]
The tricky part is that the items in the JSON array can be in a different order each time, and some may not exist. For instance, not every JSON payload has the "Has disability" piece of metadata.
So what I ended up doing was use the Read JSON activity to create two multi-value tokens:
Field Names = $.metadata[*].field_name
Field Values = $.metadata[*].field_value
Now I need to pair them up using their index values (since Workflow doesn't natively support a key-value pair...). And in order to do that, I need to check the index location of each field name in the Field Names mv token, and look at that index in the Field Values token.
A pain in the neck, basically...