Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Numerical comparisons .gte(x) .gt(x) in Jira cloud automation always equals false

André July 19, 2024

I'm trying to format a text field they way Jira Tempo does in the field Original estimate ()

I have a smart value named billable that gives me the amount of seconds:

295800s --> 1w 5d 2h 10m

{{#=}}floor({{billable}} / (5 * 8 * 60 * 60)){{/}}w {{#=}}floor(({{billable}} % (5 * 8 * 60 * 60)) / (8 * 60 * 60)){{/}}d {{#=}}floor(({{billable}} % (8 * 60 * 60)) / (60 * 60)){{/}}h {{#=}}floor(({{billable}} % (60 * 60)) / 60){{/}}m

 

so that works fine.

The next step is to show only weeks, days and hours if the smart value is big enough. So therfore I try to use the .gte(x) or .gt(x) none of them seem to work:

"{{billable}}" --> "295800"

{{#if(billable.isNumeric())}}true{{/}} --> true

 

{{if(billable.gt(2), 1, 0)}} and {{if(billable.gt(2.0), 1, 0)}} --> 0

{{if(billable.lt(2), 1, 0)}} and {{if(billable.lt(2.0), 1, 0)}} --> 0

{{#if(billable.gte(2))}} 1 {{/}} --> empty

 

1 answer

1 accepted

1 vote
Answer accepted
Bill Sheboy
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.
July 19, 2024

Hi @André 

The math functions like gt() only work on numbers (and supposedly dates / time numeric values).  Have you confirmed "billable" is a number type rather than text representing a number?  The function isNumeric() only tests if the value contains only numbers, but not that is is a number type.

You could validate that by adding asNumber conversion in one of those expressions to observe any changes.

 

And for the scenario you are trying to solve, you may want to try created variables to store the intermediate values and make the checks easier later.  For example, computing the number of weeks first.

 

Kind regards,
Bill

André July 19, 2024

@Bill Sheboy Thanks a lot. That helped.

Sitll weird for me to do multiple math actions before that smart value to then having a MUST to do a  asNumber conversion in ordert to use a .gte(x) or .gt(x)

The Atlassian Team, like @stas should really do an update for that docu. I would never get the idea to that alone :-|

Suggest an answer

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

Atlassian Community Events