Trying to set up a calculated value in JIRA. We have the value of ROI and PO but can't seem to define INC properly. Something like...
<!-- @@Formula:
def ROI = getCustomFieldValue("customfield_10914")
def PO = getCustomFieldValue ("customfield_10913")
integer INC =
(issue.get("customfield_14008") != null ? (float) Integer.parseInt(issue.get("customfield_14008")) : 0 ) +
(issue.get("customfield_14010") != null ? (float) Integer.parseInt(issue.get("customfield_14010")) : 0 ) +
(issue.get("customfield_14011") != null ? (float) Integer.parseInt(issue.get("customfield_14011")) : 0 ) +
(issue.get("customfield_14012") != null ? (float) Integer.parseInt(issue.get("customfield_14012")) : 0 );
return ROI*INC/PO
-->
I looked around on the forums and think that I found a more accurate formula but I am sure my syntax is wrong in some way.
<!-- @@Formula:
integer i =
(issue.get("customfield_14008") != null ? (float) Integer.parseInt(issue.get("customfield_14008")) : 0 ) +
(issue.get("customfield_14010") != null ? (float) Integer.parseInt(issue.get("customfield_14010")) : 0 ) +
(issue.get("customfield_14010") != null ? (float) Integer.parseInt(issue.get("customfield_14011")) : 0 ) +
(issue.get("customfield_14010") != null ? (float) Integer.parseInt(issue.get("customfield_14012")) : 0 );
(issue.get("customfield_10914") != null ? (float) Integer.parseInt(issue.get("customfield_10914")) : 0 ) *
(i != null ? (float) Integer.parseInt(i) : 0 ) /
(issue.get("customfield_10913") != null ? (float) Integer.parseInt(issue.get("customfield_10913")) : 1000000 )
-->
Any assistance would be much appreciated.
I figured it out already. It was
<!-- @@Formula:
Object cf1 =
(issue.get("customfield_14008") != null ? (float) Integer.parseInt(issue.get("customfield_14008")) : 0 ) +
(issue.get("customfield_14010") != null ? (float) Integer.parseInt(issue.get("customfield_14010")) : 0 ) +
(issue.get("customfield_14011") != null ? (float) Integer.parseInt(issue.get("customfield_14011")) : 0 ) +
(issue.get("customfield_14012") != null ? (float) Integer.parseInt(issue.get("customfield_14012")) : 0 );
(issue.get("customfield_10914") != null ? (float) Integer.parseInt(issue.get("customfield_10914")) : 0 ) *
cf1 /
(issue.get("customfield_10913") != null ? (float) Integer.parseInt(issue.get("customfield_10913")) : 1000000 )
-->
Thanks to anyone that looked.
hi @LWRET2015,
I am also looking for a calculated field, your solution might help me. Can you explain your fields use cases or what are functionality of these fields
thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It may be a bit difficult to explain the purpose for each field but I can certainly explain their relationship in the formula.
Formula for the first calculated field is (not mentioned in this post)...
single select field 1 (value of 0-3) +
single select field 2 (value of 0-3) +
single select field 3 (value of 0-3) +
single select field 4 (value of 0-3) +
= calculated field 1 (text value of 0-12, each value returns a separate text description)
Original formula for the second calculated field (which is what this post was about) is...
single select field 5 (value of 1-10) multiplied by
calculated field 1 (value of 0-12) divided by
single select field 6 (value of 1-10)
= calculated field 2 (number field)
The trick with the second formula is that I could not use calculated field 1, because it was a text field (i wanted a description in the value). So I had to recalculate the the value from the first formula to get a number value in the second formula. So the second formula ended up being more like...
single select field 5 (value of 1-10) multiplied by
[single select field 1 + 2 + 3 + 4] divided by
single select field 6 (value of 1-10)
= calculated field 2 (number field)
Basically my main issue was syntax though. I had to clean up the equation using the proper characters and terms. I was able to piece it together using a bunch of different examples from the Atlassian Community. I didn't come up with this from scratch myself. lol.
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.