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
Super User

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
Super User

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
Super User

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

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Top Solution Authors
Users online (1,845)