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 Automate / Execute a SQL Query an...
Power Automate
Answered

Execute a SQL Query and Catch a Empty Return

(1) ShareShare
ReportReport
Posted on by 114

i am running a very simple query. Say "Select * from junk" using the Execute a SQL query Action.  I if data is in the table everything works fine.  My collection is populated in Powerapps.  The problem is when the table is empty and returns nothing.  I need a way to know in powers that it returned nothing.  i need help on catching or responding with text or empty table so i can countrows to determine it is empty to continue with my next step on nothing found with Query.

 

Please help.  Dragging my brain for a day now.

 

Office 365. 

Categories:
  • manuelstgomes Profile Picture
    6,643 on at

    Hi @wsalling 

     

    I'm not an expert in PowerApps but I think you can try to catch that on the "onVisible" of the page and count if the source has or not values. If not you can do a "Navigate" to the section you want.

     

    But the good folks over at the PowerApps community can probably help you better than me:

    https://powerusers.microsoft.com/t5/Power-Apps-Community/ct-p/PowerApps1

     

    Hope this helps you

    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.
    ​
    Cheers
    Manuel

  • Verified answer
    ChristianAbata Profile Picture
    8,953 Most Valuable Professional on at

    Hi @wsalling  you can manage empty consults like this.

    resultset.PNG

    So the compose gives you a true value, and the if is true you can do somenthing.

    empty(body('Execute_a_SQL_query_(V2)')?['resultsets'])
  • wsalling Profile Picture
    114 on at

    Thank you

  • ChristianAbata Profile Picture
    8,953 Most Valuable Professional on at

    @wsalling  it was a pleasure, please don't forget to mark the answer as a solution.

  • Fred3 Xu Profile Picture
    2 on at
    Hi Mates,
    I use this fx 'empty(body('Execute_a_SQL_query_(V2)')?['resultsets'])' but still show errors:
    How should I adjust and fix it? Do you have any suggestions? thanks.

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

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 423

#2
11manish Profile Picture

11manish 308 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 177

Last 30 days Overall leaderboard