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

Jochen Berdi August 11, 2022

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
Nicholas Ellis _ALM Works_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
August 17, 2022

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
AUG Leaders

Atlassian Community Events