cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Super User III
Super User III

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
Super User III
Super User III

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

@Paulie78 That did the trick - thanks!

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (29,635)