Skip to main content
Community site session details

Community site session details

Session Id : Hk2E+6cfmYEnZe4iHT/DAK
Power Automate - General Discussion
Answered

Execute a SQL Query and Catch a Empty Return

Like (1) ShareShare
ReportReport
Posted on 6 Feb 2020 19:11:17 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. 

  • ChristianAbata Profile Picture
    8,949 Most Valuable Professional on 11 Feb 2020 at 19:17:00
    Re: Execute a SQL Query and Catch a Empty Return

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

  • wsalling Profile Picture
    114 on 11 Feb 2020 at 19:11:54
    Re: Execute a SQL Query and Catch a Empty Return

    Thank you

  • Verified answer
    ChristianAbata Profile Picture
    8,949 Most Valuable Professional on 08 Feb 2020 at 15:59:04
    Re: Execute a SQL Query and Catch a Empty Return

    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'])
  • manuelstgomes Profile Picture
    6,625 on 07 Feb 2020 at 14:23:15
    Re: Execute a SQL Query and Catch a Empty Return

    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

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

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2

Loading complete