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
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
@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 :-|
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.