Calculated Number Field update

hello, in one transition i am setting value of "last time duration" (in minutes, i.g. 10) and i would like to update Calculated Number Field "TOTAL" - add last time to TOTAL ... but when i reffer in formula to itself, it doesnt work ...

<!-- @@Formula: (issue.get("customfield_10600") != null ? issue.get("customfield_10600") : 0) + (issue.get("customfield_10602") != null ? issue.get("customfield_10602") : 0) -->

//id of TOTAL is 10602, id of last time is 10600 ...

thank you

9 answers

1 accepted

ok, i figured it out:

i have Calculated Number Field called "Total time" from plugin JIRA Misc Custom Fields. Next i have Number field "null" and Number field "last time". In transition "Add last time duration to total time" i am entering value in field "last time". In create transition i am copying valu from "total time" to "null" ---- this is my way of setting null field to value 0, because calculated number field has default value 0 if all others fields are ot defined, that i am add together in description of the Calculated number field. Next i am using number field "last value".

Description of "total time":

<!-- @@Formula: (issue.get("customfield_10600") != null ? issue.get("customfield_10600") : 0) + (issue.get("customfield_10604") != null ? issue.get("customfield_10604") : 0) -->

//id for "last value"=10600, id for "last time"=10604

The clue to achieve the result (to add a value to total counter) is in transition BEFORE entering value of "last time" execute this copying: last value := total time AND last time:= null.

Simply solutions are the best :)

0 vote

You are using some plugin, but which one? What language is that?

hi jamie, i am using

JIRA Misc Custom Fields1.5.1 where is

Calculated Number Field

p.s.: "but when i reffer in formula to itself, it doesnt work ..." - the resulted value is much more greater than expected, when i am reffering to the same field: A = A + B (A is reffering to itself)

0 vote

OK... sorry, not familiar with that plugin.

are you familiar with some other plugin, to get the correct result? sollution, when i need t add one number to total count? thx

and please can you try to give me a hint, how to manage scripting to achieve my goal? this is blocking issue for me right now ...

on some screens (screens associated with transitions between states) i can enter a value for "last duration" and after submitting the screen, i want to add this value to TOTAL duration field ...

Hi Peter Novak,

I have still not figured out the issue, I am doing exactly same given by you.

Regards

Deepak

hi

you need three variables: variable "null" with value 0, variable "old_value" and variable "add_this_value" -- these variables are Number Fields. Now you need Calcuted Number field "Total". In description of "Total" type:

<!-- @@Formula: (issue.get("customfield_10600") != null ? issue.get("customfield_10600") : 0) + (issue.get("customfield_10604") != null ? issue.get("customfield_10604") : 0) -->

10600 is ID for field "old_value" and 10604 is ID for field "add_this_value".

1. in create transition use post script Copy value from Field to Field and copy value from "Total" to "null"

2. Now say, you are entering value for field "add_this_number" via screen in "transition1". Before traansition1 you need to add post script (to transition0) that will Copy value from Field to Field: old_value := Total AND add_this_value := null;

And thats it :)

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,296 views 14 20
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot