Is it possible to Sum multiple (5 numeric fields) using the Calculated Number Field?
I'm using the formula:
<!-- @@Formula: (issue.get("customfield_11394") != null ? issue.get("customfield_11394") : 0) + (issue.get("customfield_11395") != null ? issue.get("customfield_11395") : 0) + (issue.get("customfield_1139") != null ? issue.get("customfield_1139") : 0) + (issue.get("customfield_11397") != null ? issue.get("customfield_11397") : 0) + (issue.get("customfield_11412") != null ? issue.get("customfield_11412") : 0) -->
It will add 2 fields together, why not more?
Thanks so much,
Jeff
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is the paid for add-on better? Can it handle adding multiple fields?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I haven't seen a Jira Misc Custom Fields paid add-on. I know it is possible to do this in the add-on you have though.
I personally use ScriptRunner, so please pardon my poor code...I would suggest adding a log.error before will help you find where the issue might be in your code. Example below. I haven't tested it but you could give it a try.
I think it might be an issue with your customfield_1139 (might be missing another #)
<!-- @@Formula: log.error("Value of field 1 is: "+issue.get("customfield_11394"));
log.error("Value of field 2 is: "+issue.get("customfield_11395"));
log.error("Value of Field 3 is: " +issue.get("customfield_1139"));
log.error("Value of Field 4 is: " +issue.get("customfield_11397"));
log.error("Value of Field 5 is: " +issue.get("customfield_11412"));
if (issue.get("customfield_11394") == null || issue.get("customfield_11395") == null || issue.get("customfield_1139") == null || issue.get("customfield_11397") == null || issue.get("customfield_11412"))
return null;
return issue.get("customfield_11394")
+ issue.get("customfield_11395")
+ issue.get("customfield_1139")
+ issue.get("customfield_11397")
+issue.get("customfield_11412");
-->
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yikes! Good catch :)
I'm horrible at coding too (as you can see, lol).
Thank you very much! I'll let you know if it works.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Jeff,
The log.error before what you're statement will help with these things. :) I learned that early and it saves so much time! Happy coding!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I feel like such a goof. When I corrected the field ID, it worked. Thank you so very much @Brittany Wispell
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Jeff Bolin No problem! Sometimes it just takes a second pair of eyes :)
If you wouldn't mind accepting my answer as this questions is answered that would help me out. Thanks!
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.