Dan T.
Dan T.

Reputation: 425

Azure Logic App - Foreach over sql resultset

I'm using an Execute Sql Query action in logic app. Returned result is composed of 1..n tables ("selects"). I want to create a csv table and send it over tfs.

The issue I'm having is that the tables are elements of resultset, and not part of an array.

Is there some way to perform ForEach action on the resultset elements (i.e. - 'Table1', 'Table2', etc...)?

Upvotes: 0

Views: 5421

Answers (3)

Ibrahim Schi
Ibrahim Schi

Reputation: 418

In DesignView, you can use Parse JSON after SQL querying step.

Then, you can use for each in order to reach each database record. Because SQL resultset returns as JSON object in the Logic App.

Upvotes: 1

Mahesh B
Mahesh B

Reputation: 143

Foreach on a Resultset will return JSON object of each row. I couldn't find any option DesignView to extract the value but you can achieve same in CodeView by assigning following code to your variable in CodeView.

In below MEETINGID is my column name.

"@{items('For_each')?['MEETINGID']}" "imeetingid": "@{items('For_each')?['MEETINGID']}"

Upvotes: 0

Tom Sun
Tom Sun

Reputation: 24549

Is there some way to perform ForEach action on the resultset elements (i.e. - 'Table1', 'Table2', etc...)?'

According to the mentioned data format, it seems that it is not supported via foreach action in logic app.

If Azure function is acceptable, I recommend that you could use the Azure function to implement it with your customized logic to deal with data.

Upvotes: 2

Related Questions