Skip to main content

Notifications

Power Automate - General Discussion
Answered

How to conditionally count rows in SQL. If > 0 then continue the flow; else stop

(0) ShareShare
ReportReport
Posted on by

I have set up a table in SQL where I store approvals, including a column where I save an approval status (Pending, Approved, Rejected).

 

As part of a reminder process, I would like to send a message out conditioned on there being more than one item Pending in the Approval status column.

 

How do I count the number of rows in the table where Approval Status = Pending and then use the result in a Condition (if > 0 then continue the flow; else stop)?

  • Verified answer
    Re: How to conditionally count rows in SQL. If > 0 then continue the flow; else stop

    That's it!.  Thanks so much!

  • Verified answer
    yashag2255 Profile Picture
    yashag2255 24,442 on at
    Re: How to conditionally count rows in SQL. If > 0 then continue the flow; else stop

    Hey @Anonymous 

     

    You can use odata filter queries to filter out the records and more details can be found here: https://toddbaginski.com/blog/use-dynamic-odata-filter-values-in-a-microsoft-flow-sharepoint-getitems-action/

     

    Then you can use the length function in flow expression editor to check the length of the list returned from the above action and implement the logic further. 

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. 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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

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

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,495

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,822

Leaderboard