Ok Solved it. (See workflow at bottom)
I actually did not need to use a dictionary. I could loop through the string returned from the look up column, and looking for comma's, look for one of 3 cases:
1. no comma but string is non-empty ( 1 country defined)
2. at least one comma so there is at least two or more countries so loop
3. (in the loop) we have consumed all the commas so we have found the last country.
Things to note:
1. "Find string in string (output to Variable:index)" will return -1 if doesn't find the searched for string.
2. In the opening statement "Set Variable: Countries to Current Item:Destinations" set the return field as "Lookup Values, Comma Delimited" or else you will get back column item meta-data as well as the actual values
you are after.
If any once has any questions just post a reply and I will try and answer them.
Cheers
Stage:Countries Workflow
Set Variable: Countries to Current Item:Destinations
Step: If we have at least one country
If Variable: Countries is not empty value
Find , in Variable: Countries (Output to Variable: index )
If Variable: index is less than 0
Step: There is no comma so there must only be one country
Do something sensible with "Countries"
Else
Set Variable: loop to Yes
Loop: There is at least one comma, hence at least two countries so we will loop over them
The contents of this loop will run repeatedly while: Variable: loop equals Yes
Copy from Variable: Countries , starting at 0 for Variable: index characters (Output to Variable: substring-country )
Do something sensible with "Substring-countries"
Replace [%Variable: substring-country%], with in Variable: Countries (Output to Variable: Countries )
Find , in Variable: Countries (Output to Variable: index )
If Variable: index is less than 0
Step: We have found the last country, so do somthing with it and then stop
do something sensible with "Countries"
Set Variable: loop to No
Transition to stage
Go to End of Workflow
-
Marked as answer by
BruceB001
Wednesday, August 28, 2013 9:35 PM
-
Edited by
BruceB001
Wednesday, August 28, 2013 9:51 PM