cancel
Showing results for
Did you mean:
See all
##### Top groups
Explore all groups

# Smart values to create summary don't give expected result

Ruben Uyterlinde March 26, 2024

Hi,

Context: As of 1st of April July 2024 Jira will limit the amount of worklogs per item (Our worklog is above the max of 5000). We have one project which we use purely for time tracking.

So I'm currently making a automation to create new ticket every half year. In the summary I want the following: "Worktime yyyy-Hh", with yyyy being the year and h being what half of the year.

For the summary of the newly created ticket I have the following formula:

Worktime {{now.format("yyyy")}}-H{{now.format("Q").asNumber.divide(2).ceil}}

Current date is 2024-03-26

now.format("yyyy") => 2024

now.format("Q") => 1

now.format("Q").asNumber => 1

now.format("Q").asNumber.divide(2) => 0 (expected 0.5)

now.format("Q").asNumber.divide(2).ceil => 0 (expected 1)

What formula can I use to achieve this required results?

Greetings,

Ruben

#### 1 accepted

Tugba Capaci
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.
March 26, 2024

What are H0 and H1? Are they representing the halves of the year?

If so, you can use the following:

`{{now.format("yyyy")}}-H{{#if(now.monthOfYear.lte(6))}}1{{/}}{{#if(now.monthOfYear.gt(6))}}2{{/}}`

If not, could you please clarify? I'd like to assist.

For math expressions you can check out the doc here.

Tugba
actioner.com

Ruben Uyterlinde March 26, 2024

Thanks, nice way to solve it! Variable h was indeed representing havles of years.

Do you get the same result when using these fomula's, just to verify. I consider them bugs and will report them if you get the same result.

now.format("Q").asNumber.divide(2) => 0 (expected 0.5)

now.format("Q").asNumber.divide(2).ceil => 0 (expected 1)

Greetings,

Ruben

Tugba Capaci
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.
March 26, 2024

Yes, i am getting the same result.

divide(2) and divide(2).ceil always return 0.

Ruben Uyterlinde likes this
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.
March 26, 2024

It appears the integer typing follows through to the end of the calculation after the earlier use of the format() function.

Please try using the longer form of the math operations when you want to manage the typing and significant digits:

`{{#=}}CEILING ( {{now.format("Q")}} / 2 ){{/}}`

Or...

First create a variable with a value of 1.0 and multiply that by the formatted date's quarter before the division.  I believe this will force the typing to continue.

`{{varOne.asNumber.multiply(now.format("Q").asNumber).divide(2).ceil}}`

Kind regards,
Bill