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}")
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}")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.