cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
StinkyD01
Helper III
Helper III

Powerapps display stored procedure data in a Collection in OnStart

All - I created a power automate to run a SQL stored procedure. I have tested the flow and its pulling in data. I have the flow added into PowerApps and when I run it, you can see its running successful in power automate. I need to make a collection of this information. I have the following in the OnStart of the app as follows: 

Set(myCollection, TPA_SP.Run(DatePickerStart.SelectedDate,DatePickerEnd.SelectedDate) 

Would anyone know how I can get the data from this stored procedure into a collection? Thank you!

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @StinkyD01 ,

 

There are 2 methods.

1\ Use response action in flow. It will return an array from flow to canvas app, you can create a collection directly something like: ClearCollect(Col, flow.Run())

 

vxiaochenmsft_0-1666851892416.png

 

 

2\ Use ParseJson function in powerapps. Using this function, the canvas just need a json string coming from flow instead of an array.

https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-parsejson

 

vxiaochenmsft_1-1666852077908.png

 

 

Best Regards,

Wearsky

 

View solution in original post

Hi @v-xiaochen-msft 

Thank you so much for responding to me. Your suggestions helped me. Plus, I'm using a Date Range too. 
I was able to get this to work with the following:

StinkyD01_0-1667058066093.png

Set(
varDatafromFlow,
TestStoredProcedure_Sorting.Run(
DatePickerStart.SelectedDate,
DatePickerEnd.SelectedDate
).response
);
Set(
varDataFlow,
ParseJSON(varDatafromFlow)
);

Then on my Gallery Items: Table(ParseJSON(varDatafromFlow))

Thank you again

View solution in original post

2 REPLIES 2
v-xiaochen-msft
Community Support
Community Support

Hi @StinkyD01 ,

 

There are 2 methods.

1\ Use response action in flow. It will return an array from flow to canvas app, you can create a collection directly something like: ClearCollect(Col, flow.Run())

 

vxiaochenmsft_0-1666851892416.png

 

 

2\ Use ParseJson function in powerapps. Using this function, the canvas just need a json string coming from flow instead of an array.

https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-parsejson

 

vxiaochenmsft_1-1666852077908.png

 

 

Best Regards,

Wearsky

 

Hi @v-xiaochen-msft 

Thank you so much for responding to me. Your suggestions helped me. Plus, I'm using a Date Range too. 
I was able to get this to work with the following:

StinkyD01_0-1667058066093.png

Set(
varDatafromFlow,
TestStoredProcedure_Sorting.Run(
DatePickerStart.SelectedDate,
DatePickerEnd.SelectedDate
).response
);
Set(
varDataFlow,
ParseJSON(varDatafromFlow)
);

Then on my Gallery Items: Table(ParseJSON(varDatafromFlow))

Thank you again

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

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

Community Call Conversations

Introducing the Community Calls Conversations

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

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,532)