Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,361,178
Community Members
 
Community Events
168
Community Groups

ALM Structure: Count specific comments and visualise them as a multi bar

Hello
our Jira comments start with status-.
Afterwards there are, for example, the values BA and BR, i.e. Status-BA.
These entries can be repeated.

In the sense of a trend, we would like to have the hits BA and BR increase in the sense of a Wiki Markup Multi Bar.

Unfortunately, this formula is unsuccessful:

With Status_Match =
comments.FILTER($.MATCH("/\Astatus-/")) :

With String = IF Status_Match:
Status_Match.map(
CONCAT(
substring($.body,7,9))
) :

with granularity=20: with bar = "█":

with BA=FLOOR(COUNT#truthy{String="BA"}/COUNT{1}*granularity): with BR=FLOOR(COUNT#truthy{String="BR"}/COUNT{1}*granularity): with BG=FLOOR(COUNT#truthy{String="BG"}/COUNT{1}*granularity): with other=granularity-BA-BR-BG:

//Bar chart

CONCAT("{color:red}",REPEAT(bar, BR),"{color}{color:orange}", REPEAT(bar, BA),"{color}{color:green}", REPEAT(bar, BG),"{color}{color:gray}", REPEAT(bar, other),"{color}")

1 answer

1 vote

Hi Jochen,

This formula is actually really close.  The problem you are running into is scope.  When you define String at the top it is in the main scope, but when we use an aggregation function like COUNT{}, we enter into a new scope where that variable is no longer accessible.  All we need to do to fix it is define our variables inside the scope of the aggregation functions.  This makes the code a bit redundant, but it works.  Here is my working example.

with granularity=20: with bar = "█":

with BA=FLOOR(COUNT#truthy{
With Status_Match =
comments.FILTER($.MATCH("/\Astatus-/")) :
With String = IF Status_Match:
Status_Match.map(
CONCAT(
substring($.body,7,9))
) :
String="BA"
}/COUNT{1}*granularity):

with BR=FLOOR(COUNT#truthy{
With Status_Match =
comments.FILTER($.MATCH("/\Astatus-/")) :
With String = IF Status_Match:
Status_Match.map(
CONCAT(
substring($.body,7,9))
) :
String="BR"
}/COUNT{1}*granularity):

with BG=FLOOR(COUNT#truthy{
With Status_Match =
comments.FILTER($.MATCH("/\Astatus-/")) :
With String = IF Status_Match:
Status_Match.map(
CONCAT(
substring($.body,7,9))
) :
String="BG"
}/COUNT{1}*granularity):

with other=granularity-BA-BR-BG:

//Bar chart

CONCAT("{color:red}",REPEAT(bar, BR),"{color}{color:orange}", REPEAT(bar, BA),
"{color}{color:green}", REPEAT(bar, BG),"{color}{color:gray}", REPEAT(bar, other),"{color}")

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

Apps for Confluence you won't want to miss: RSVP for September's Appy Hours

Calling all collaborators and Confluence users! Our Appy Hours event on September 29th features 4 presenters demoing functionality to superpower Confluence. Don't miss learning about these apps i...

120 views 0 9
Read article

Atlassian Community Events