Hi,
i use Misc Custom Fields and i want to calculate the Difference between 2 Dates in days.
Date 1 is Customfield 13478, Date 2 is Customfield 13471.
I create an Customfield this these describtion:
<!-- @@Formula: (issue.get("customfield_13471") != null? issue.get("customfield_13471") : 0)
- (issue.get("customfield_13478") != null? issue.get("customfield_13478") : 0) -->
and Type "Calculated Date/Time Field"
and an other with Type "Calculated Nunber Field"
Both Fields are available on the issuescreen. Tested by "Where is my sreen". But i didnt see one of these calculated with the days (Customfield_13471)-(Customfield_13478).
Desired Result an these Example:
(2014/03/24)-(2014/03/01)=23
Thanks for your help!
Best regards
Stephan
First, you need to create the 2 date fields you want to play with.
To get the custom field ID, go to your custom field administration and place your mouse on the "edit" button (don't click). On the bottom left corner of your screen you will see the field ID.
To create the calculated field, you need to create a new custom field of the type : calculated number field
In the description you add (please replace the ID by yours):
<!-- @@Formula:
if (issue.get("customfield_13471")==null || issue.get("customfield_13478") == null)
return null;
return (issue.get("customfield_13471").getTime() - issue.get("customfield_13478").getTime())/ 1000 / 3600 / 24; -->
If one of the date fields you used is null, the calculated field will return null so it won't appear on your screen.
Hope it helps
Best
i checked this , im recieving 0 when both fields are empty , so that means this is working , but when it do have date values it do not comes with a value .
I'm using date fields for calculation , not date/time fields
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi There , Any updates on this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Constance Hua, I tried everything but this is what the error i'm receiving, can you please help what is pending with this?
Also, looks like when i'm using the formula the getTime() part is getting marked in red is that something is missing?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi @Prashant Samal,
those fields are not existing as fields. They are just some kind of metadata it seems.
You need to create manually those fields or find their id
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Stephan
Are you using jira cloud or jira server . Did you find any solutions for this. I am trying to solve a similar issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hello Stephan Rothämel
i want to ask u about this logic i am not clear with this ,can u explain me <!-- @@Formula: (issue.get("customfield_13471") != null? issue.get("customfield_13471") : 0)
- (issue.get("customfield_13478") != null? issue.get("customfield_13478") : 0) --> in which the result of formulla is coming on which custom field means datetime or numberfield .and i am also confused about customfield_13478 this is your custome field name of id how i get this please clear my doubt
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you may try below one:
<!-- @@Formula: issue.get("customfield_13471")==null ? null : (issue.get("customfield_13471").getTime() - issue.get("customfield_13478").getTime()) / 1000 / 3600 / 24 -->
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sonya
Questions for you....
Where should I insert that code? Would you give please help give more details? The code is some kink of Jira scripting language?
Thanks
J.N
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.