Jira Structure - Colored box formula based on count sub-items value

Julia M_ January 28, 2023

Hello,
I have a structure with multiple filters. One of the columns I use is Count Sub-Items.
I would like to have another column which contains a colored box depending on the amount of sub-items I have.
For example:
- if count sub-items = 0, then show a green box with text "OK"
- if count sub-items < 10, then show a yellow box with text "Check"
- if count sub-items >= 10, then show a red box with text "Risk"
Could you please help?

1 answer

1 vote
David Niro
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 1, 2023

Hello @Julia M_ ,

Welcome to the Community!

This should work for you:

with _count = SUM#children{1}:
with _format(text,color) =
"""{panel:borderStyle=solid|borderColor=white|bgColor=$color}$text{panel}""":

IF _count = 0:
_format("OK","green")
ELSE IF _count < 10:
_format("Check","yellow")
ELSE:
_format("Risk","red")

Please set the option from General to Wiki Markup

It starts off with defining a local variable _count.  This will essentially count all of the sub-items under each parent.  

Next, we create a function for the formating

Lastly, we use the conditional statements to define which values to display the correct text and box color for.

Please let me know if this helps! 

Best,
David

Suggest an answer

Log in or Sign up to answer