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 blog
Power 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 blog
Power Automate Video Tutorials
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 blog
Power Automate Video Tutorials

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,887)