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 / Return valid empty lis...
Power Apps
Answered

Return valid empty list for Execute a SQL Query Flow

(0) ShareShare
ReportReport
Posted on by 127

I create a Flow to run a query against Azure MS SQL table in the form of Response. If I don't add a condition to check for empty result, the Flow fails with "error parsing". So I added a condition to check and only proceed to the Response if there are rows returned. For the condition of no result, I simply do nothing. This results in the "bad gateway" error because the receiving end doesn't get any response back. I'm looking for a way to handle the no result in a way that the receiving end gets an empty list.

flowsqlquery.PNG
Categories:
  • jorge.daniel Profile Picture
    1,430 Super User 2024 Season 1 on at

    Hi,

     

    In your schema, allow for null values like this:

     

    "YourKey": {
    "type": ["number","null"]
    }

  • tedqn77 Profile Picture
    127 on at

    Thanks but where do I enter that?

  • jorge.daniel Profile Picture
    1,430 Super User 2024 Season 1 on at

    In your response body JSON schema

  • Verified answer
    tedqn77 Profile Picture
    127 on at

    Changing "type": ["number","null"] results in Powerapps complains of invalid json syntax. After some research I was able to get rid off the Condition and handle the empty issue in the Response body. Basically if the result is empty, hardcode a json string with empty items.

     

    @{if(empty(body('Execute_a_SQL_query_(V2)')?['resultsets']), json('{"type": "array",
    "items": {}}'), body('Execute_a_SQL_query_(V2)')['ResultSets']['Table1'])}

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 409 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 252 Most Valuable Professional

Last 30 days Overall leaderboard