cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Olivier_Defaux
Level: Powered On

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

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)?

2 ACCEPTED SOLUTIONS

Accepted Solutions
Dual Super User
Dual Super User

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

Hey @Olivier_Defaux 

 

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-getitem...

 

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!

View solution in original post

Highlighted
Olivier_Defaux
Level: Powered On

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

That's it!.  Thanks so much!

View solution in original post

2 REPLIES 2
Dual Super User
Dual Super User

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

Hey @Olivier_Defaux 

 

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-getitem...

 

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!

View solution in original post

Highlighted
Olivier_Defaux
Level: Powered On

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

That's it!.  Thanks so much!

View solution in original post

Helpful resources

Announcements
firstImage

Power Platform Online Conference

Speakers, submit your sessions now! Call for speakers ends Feb. 10!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,974)