cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SamTimmins
Regular Visitor

Using outputs from SQL procedure

Hi Team,

 

I'm attempting to use a flow which returns an SQL stored procedure, and then use the values to create entries into a shared calendar in Outlook. 

 

However, I'm not having much luck with getting the Email & Date value extracted from the return (example below)

 

I had a look at the string conversion options, and trying to use substring to gather the required values with indexValues however it seemed very messy and I'm sure there is a better way to convert/filter (to an array perhaps?) so that I can easily extract the email and date, particularly when there will be multiple rows returned.

 

Any suggestions appreciated

{
  "ResultSets": {
    "Table1": [
      {
        "EMail": "email@domain.com.au",
        "TransDate": "2020-02-20T00:00:00"
      }
    ]
  },
  "OutputParameters": {}
}

 

1 ACCEPTED SOLUTION

Accepted Solutions
abm
Super User III
Super User III

Hi @SamTimmins 

 

Follow the below steps:

image.png

 

Next use a Parse JSON to extract the values

image.png

The above schema I used is as follows: (Copy & Paste the same schema in your flow action step)

 

{
"type": "object",
"properties": {
"ResultSets": {
"type": "object",
"properties": {
"Table1": {
"type": "array",
"items": {
"type": "object",
"properties": {
"EMail": {
"type": "string"
},
"TransDate": {
"type": "string"
}
},
"required": [
"EMail",
"TransDate"
]
}
}
}
},
"OutputParameters": {
"type": "object",
"properties": {}
}
}
}
 
Next we need to iterate the JSON object to extract the values
image.png
 
Here are my test results:
image.png


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials

View solution in original post

5 REPLIES 5
abm
Super User III
Super User III

Hi @SamTimmins 

 

Follow the below steps:

image.png

 

Next use a Parse JSON to extract the values

image.png

The above schema I used is as follows: (Copy & Paste the same schema in your flow action step)

 

{
"type": "object",
"properties": {
"ResultSets": {
"type": "object",
"properties": {
"Table1": {
"type": "array",
"items": {
"type": "object",
"properties": {
"EMail": {
"type": "string"
},
"TransDate": {
"type": "string"
}
},
"required": [
"EMail",
"TransDate"
]
}
}
}
},
"OutputParameters": {
"type": "object",
"properties": {}
}
}
}
 
Next we need to iterate the JSON object to extract the values
image.png
 
Here are my test results:
image.png


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials

View solution in original post

ChristianAbata
Super User II
Super User II

hi @SamTimmins  you can parse your asnwer with parse json.

Frist in content you need to pass your output, then clic on generate from sample an paste the answer that you paste here and then just done, you are going to be able to use every part of your response.

json.png



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA
PAUser70
Frequent Visitor

HI,

 

I have the same issue trying to extract values from the store procedure's output body. I followed all the steps to create compose and Parse JSON but I am getting an error 

 

ExpressionEvaluationFailed. The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@body('Parse_JSON')?['ResultSets']?['Table1']' is of type 'Null'. The result must be a valid array.JSON error.png

 

 

JSON Setup error.png

abm
Super User III
Super User III

Hi @PAUser70 

 

Could you please post a sample JSON data where I can copy and paste in my test flow.

 

Thanks

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Users online (1,902)