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 / Capture Rows Count fro...
Power Automate
Answered

Capture Rows Count from Query Result

(0) ShareShare
ReportReport
Posted on by 21

Hello Everyone 

 

In PAD I’m trying to capture a Rows count to be used later in ( Conditional IF Action ) from ( Execute SQL Statement ) which the results shows in the Flow Variables as the screen below .

 

 

Annotation 2024-03-07 092432.png

 

so basically I need to learn how write the expression in the ( Conditional IF Action ) for example if the Rows Count greater than 43 go to next step .

I have the same question (0)
  • Verified answer
    VishnuReddy1997 Profile Picture
    2,656 Super User 2026 Season 1 on at

    Hi @Waleed65 ,

     

    Please find the below solution.

    Sql 1.png

     

    Code:

    SET Excel_File_Path TO $'''\"C:\\Users\Desktop\\Power Automate Desktop\\Practice\\EXCELASDATABASE\\Input.xlsx\"'''
    SET OLEDB_ConnectionString TO $'''Provider=Microsoft.ACE.OLEDB.12.0;Data Source=%Excel_File_Path%;Extended Properties=\"Excel 12.0 Xml;HDR=YES\";'''
    Database.Connect ConnectionString: OLEDB_ConnectionString Connection=> SQLConnection
    @@copilotGeneratedAction: 'False'
    Database.ExecuteSqlStatement.Execute Connection: SQLConnection Statement: $'''select *from[Employee_Personal_Details$]''' Timeout: 30 Result=> QueryResult
    Database.Close Connection: SQLConnection
    IF QueryResult.RowsCount > 43 THEN
    Display.ShowMessageDialog.ShowMessage Message: QueryResult.RowsCount Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed
    ELSE
    Display.ShowMessageDialog.ShowMessage Message: $'''GO TO NEXT STEP''' Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed
    END

     

     

    NOTE: Mark it as a solution if it works.

  • Verified answer
    Deenuji_Loganathan_ Profile Picture
    6,255 Moderator on at

    @Waleed65 

    You have the option to select any operator from the operator dropdown, which encompasses most of the necessary mathematical formulas such as:

    • Equal to
    • Not equal to
    • Greater than
    • Greater than or equal to
    • etc...

    For more details with examples, refer the below MS document:

    Use logical operations on conditional statements - Power Automate | Microsoft Learn

    Using conditionals - Power Automate | Microsoft Learn

     

    You can choose according to your business logic and proceed to place the next set of actions within the if condition.

    If condition Operators

    Deenuji_0-1709797998770.png

    If condition:

    Deenuji_1-1709798192154.png

     

  • Waleed65 Profile Picture
    21 on at

    The expression ( %QueryResult.Rowscount% ) wrote in the First operand was what i needed exactly , thanks both of you @Deenuji @VishnuReddy1997  .

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 Automate

#1
Vish WR Profile Picture

Vish WR 796

#2
Valantis Profile Picture

Valantis 568

#3
Haque Profile Picture

Haque 538

Last 30 days Overall leaderboard