0
votes

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...)?

3
If possible, please add the resultset format in the question. Json ,XML or others? If there is sample data will be helpful. - Tom Sun - MSFT
"ResultSets": { "Table1": [ { A UnitData... }, { B UnitData... }, ... ] "Table2": [ { X UnitData... }, { Y UnitData... }, ... ] } - Dani Toker
This is the output of the SQL query, that divides the results to 1000 rows on each table, each unit data element is a returned row, all tables have same elements structure. - Dani Toker

3 Answers

2
votes

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.

0
votes

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']}"

0
votes

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.