As can be seen from my previous postings, I’m still spending my evening hours researching and playing around with the Azure App Service offering. And to be honest, the more you know, the more interesting it gets. However from time to time you will run into simple challenges like how to iterate over a collection of items?
ATTN: This only applies for workflows created with the schema “2014-12-01”. Workflows created with a newer schema version will be using different connectors, syntax and a new designer. The updated version targeting schema version 2015-08-01-preview can be found here.
Azure Logic App – Repeat Logic
Achieving this using the designer is actually very simple. First place a logic block and action responsible for returning the collection (I’m using a SQL Server Connector). The second step requires placing the logic block and selecting the action which needs to be repeated for all items within the collection. Once placed, click on the gear icon in the right upper corner and select Repeat over a list.
At this point, select the collection within the text box called Repeat and continue configuring the action as desires and you’re done.
You can also type one of the following syntax samples directly within the text box:
If you want to access data within an item, just start with
@repeatItem().NameOfTheField or use the designer to do this for you. The code generated by the designer can be accessed by clicking on the Code View button.
Azure Logic App – Workflow Designer
Just in case you’re interested –At Build 2015, the team responsible for Azure App Service mentioned that they would like to keep the workflow designer as clean as possible. So that’s likely the reason why this option is hidden. What’s somewhat odd is that the team previously wrote that the current version was designed with developers as end users in mind. Well maybe it’s me but I think developers should be able to cope with some complexity…
Logic App Workflow Definition Language – https://msdn.microsoft.com/en-US/library/azure/dn948512.aspx