Show table in automation email only if the count is greater than 0

Andy Kettle
Contributor
December 3, 2024

Hi,

 

I've got this working beautifully it gathers all the types and outputs them into a table view in an email. The issue I have is it's putting the table in even if the smart variable count is 0. I would like the table not to appear if the count is 0.

The below is the code. I think it's just where the IF statements sit. I want it to basically be if the count is 0 display 'There are no bugs' then skip this whole table. If there are then display the table and all values that fall into this.

 

Thanks

Screenshot 2024-12-03 145312.png

1 answer

1 accepted

2 votes
Answer accepted
Dick
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 3, 2024

Hi @Andy Kettle 

I think your closing {{/}} just above </table> should move up all the way to the first line (as that's closing the fist if statement. 

then you need the opposite if statement to handle your table (in its totality, so you'll end up with an {{/}} under the </table> tag.

 

Kind regards,

Dick

Andy Kettle
Contributor
December 3, 2024

Hi @Dick

 

Thank you for your fast reply. It appears it was two issues. One was indeed the closing being in the wrong place but the second was the count was 0 so that's why it was showing. I've now changed it to a not equals and it's working. 

Screenshot 2024-12-03 153003.png

Like Dick likes this
Dick
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 3, 2024

Hi @Andy Kettle 

Well done to you!

Know that you still can have the "there are no bugs" feedback to the user by adding the original if statement:

{{#if(equals(varRenewalsCount, "0"))}}There are no bugs{{/}}

 

Kind regards,

Dick

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events