Skip to main content

Hello, this one sounds easy but it honestly frustrating me a bit.

 

 

How do you loop through a collection and just keep moving through the collection to evaluate the parts. In my collection I have TOOLNAME and RECOMMENDATION. Ultimately I would have around 5 recommendations per tool and those would be put into text variables and used in the output document generation. 

 

Collection: colRecommendations

Fields: ToolName (Text), Recommendation (Text)

 

Example Collection Content:

 

What Id like to end up with:

skype_recommendation = "How to make a call - http://zzzzz <br/> Setting up your headset - http://xxxxx"

outlook_recommendation = "Drafting a message - http://wwww"

 

Assumptions:

  1. A loop to move through the collection
  2. A switch with options for each tool I expect
  3. A build string action in each switch option that would keep the previous value and append the next as we move through the loop

 

Principal issue: Moving through the collection and pulling out the individual parts of the collection for the current item in the loop so I can evaluate the current tool and add the recommendation to the appropriate variable.

Hi

I did something similar on Office 365 last week. Unfortunately, my contracted ended so I don't really have access to the tenant.

  1. You set up your Query List Action (assuming it is in same site as w/f)
  2. I would advice single output and pass this to a dictionary variable
  3. Store the count of rows returned in a var e.g numResults
  4. set another var numIndex to 0
  5. Use a for Each Action numIndex is Less Than numResults
  6. {
  7.  the Get Dictionary Item for each of your 2 columns .  The Path is simply the name of the column. You pass the output to your string (or whatever) variable 
  8. use a Calculator Action to increment var numIndex
  9. }

The only issue I ever found is that if there nulls in certain columns , it suspended the workflow but I seem to remember these were  Data Time columns.   Use plenty of Log Actions on any of the variables used to check their values. 

Good luck


Thanks, I have a question, when you use Query List it only allows Collection variables so are you saying to create a dictionary and place the collection from the Query List into it?


Yes, definitely. I may have a screen dump somewhere of it in use. Will check in the morning (BST).

Daniel

Get Outlook for Android<https://aka.ms/ghei36>


Hi Mark,

Unfortunately, I don't have any screen dumps but I do remember what my set up I have tested out.

  • I used a Dictionary var with Query List configured with single output and returning multiple rows
  • I used a Collection var with Query List reconfigured with separate outputs per column and returning multiple rows - you effectively need a collection var per column
  • I used an individual var e.g. Text when Query List is configured  withseparate outputs per column and returning a single row

Hope this helps.


Reply