web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Flow Blank SQL Query R...
Power Apps
Unanswered

Flow Blank SQL Query Response to PowerApps

(0) ShareShare
ReportReport
Posted on by 64

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?

 

Flow View Run Mode - Success with No Data.png
Flow Edit Mode Screenshot.png
Flow View Run Mode - Failed Due to No Data.png
Categories:
I have the same question (0)
  • DocWHCI Profile Picture
    24 on at
    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 846

#2
Valantis Profile Picture

Valantis 532

#3
Haque Profile Picture

Haque 410

Last 30 days Overall leaderboard