cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ocdc2008
Level: Powered On

Flow Blank SQL Query Response to PowerApps

Hello,

 

I wrote a flow that works very nicely except when the SQL query returns nothing. The attachment named "Flow View Run Mode - Failed due to No Data" illustrates the original issue. PowerApps would receive a 502 Error stating it was a bad connection.

 

I added a condition to the Flow in order to differentiate if the SQL Query returned a table or not. If it did, send the query results back to PowerApps, otherwise respond to PowerApps with a 400 error. The "Flow Edit Mode Screenshot" attachment shows the flow condition.

 

This change worked, but I don't like it because it relies on the IfError function in PowerApps which is an experimental function that may go away. It also doesn't explicitly catch the 400 error.

 

I'd like to find a way to deal with this in Flow, but I can't figure it out. Can I return a blank query with the same schema as if there was data?

 

1 REPLY 1
DocWHCI
Level: Powered On

Re: Flow Blank SQL Query Response to PowerApps

One way you could possibly deal with it is by using 2 Run After actions, one that runs after the query succeeds and one if it fails, times out, or is skipped.

On the run after for Success return your value to powerapps.

On the run after for fails, etc then return a blank/null value or any other constant value.

In your power app just check if the value is null or not, or if you have it a constant value like 0 or “failed”.

Something like Set(ReturnValue, FlowName.Run(....);
If(IsBlank(ReturnValue), /*Handle failure and display error with Notify*/, /*Handle success*/)

You could also use UpdateContext instead of set if you only want a local variable.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (4,399)