cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Configuring Condition to check if HTML table is empty before sending email

Hi everyone!

 

I'm almost finished with a flow that will send an HTML table in the body of an email, but I'd like to check if the HTML table is empty before sending the table. I saw other solutions that recommended checking the length of one of the fields in the table to make sure it's not empty, but I'm running into a wall. Can you help me configure this Condition? 

 

For clarification, there are two tables sources - one with data and one with email addresses. Both contain the field Branch Name. 

Conditional - Check if table is empty.PNG

Here's the error message I receive: 

Conditional - Error Message.PNG

 

I've also tried length(body('Select_Inventory_Table_Fields')?['Branch Name']), but that also doesn't seem to work. 

 

Thank you! 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Anonymous ,

 

The expression should work:

length(body('Select_Inventory_Table_Fields'))

 

Best Regards,

Alice

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

9 REPLIES 9
Jcook
MVP

Hello @Anonymous 

 

What is your error when you use the second expression you showed?


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





Anonymous
Not applicable

Thanks so much for taking the time to reply! Here's the error message I received for the second expression. 

Conditional - Error Message2.PNG

Jcook
MVP

Hi @Anonymous 

 

Can you try using empty() expression instead?

 

Try:

empty(outputs('Select_Inventory_Table_Fields')?['Branch Name'])

is equal to

false


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





Anonymous
Not applicable

Thank you, I really appreciate you helping me! I tried it, but for some reason it evaluated as false.

 

Here's a screenshot of the result of Select Inventory Table Fields where Branch Name is not empty:

Select Inventory Table Fields.PNG

 

Here's the result of the conditional + email: 

Conditional - Not Fulfilled.PNG

 

Just to check (for science!), I set the conditional to true, and it sent all the emails, even those with empty tables. 

Hi @Anonymous ,

 

Take a try with expression:

length(outputs('Select_Inventory_Table_Fields'))

check if the expression is greater that 0.

 

Best Regards,

Alice

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

Hi! 

 

It looks like that expression is giving me a different type of error: 

Conditional - Error Message3.PNG

I feel like we're getting closer! Thank you for your help! Let me know if you think of anything else to try! 

@Anonymous 

 

Try using:

 

empty(outputs('Select_Inventory_Table_Fields'))

 

is equal to false

**Use the expression false (see below)**

 

Jcook_0-1597254593228.png

 

 

** Update -- Please note that you may want to move your send email action to the if no branch for my solution above. For context the empty expression will return true if the value being passed is empty. **

 


Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips,
tricks, and guides
FlowAltDelete





Hi @Anonymous ,

 

The expression should work:

length(body('Select_Inventory_Table_Fields'))

 

Best Regards,

Alice

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@v-alzhan-msft Thank you so much!! This one works! 

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (5,494)