cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DBean
Frequent Visitor

Flow failing when SQL query returns empty set

I've created a flow that fails when the SQL query returns an empty set.  I've found lots of mentions of similar issues, but none that include a solution.
This is a very simple flow - I'm searching a database for employees with a given start date, and sending an email to each of them.  Often, though, there are no employees with a particular start date, and the flow fails.

DBean_0-1611256180145.png

 

I've tried this:

 

DBean_3-1611256817968.png

 

And that doesn't work:

DBean_4-1611256891983.png

 

I found mentions of an "Empty" function, but when I try using that instead of "Null", I get this:

DBean_2-1611256667801.png

Any thoughts?  Thanks in advance!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Paulie78
Super User
Super User

The SQL connector returns a bunch of outputs, I would suggest you use something like:

not(empty(outputs('Execute_a_SQL_query_(V2)')?['body/resultsets/Table1']))

On the left side of your condition and the true expression on the right side. Make sure you use the expression true, not just type true in, like this:

EmptySQL.jpg

View solution in original post

2 REPLIES 2
Paulie78
Super User
Super User

The SQL connector returns a bunch of outputs, I would suggest you use something like:

not(empty(outputs('Execute_a_SQL_query_(V2)')?['body/resultsets/Table1']))

On the left side of your condition and the true expression on the right side. Make sure you use the expression true, not just type true in, like this:

EmptySQL.jpg

DBean
Frequent Visitor

@Paulie78 That did the trick - thanks!

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (2,202)