Calculated NUmber Field is not shown on defined page...

Eugene Kushnir March 7, 2018

I am using 2 formulas to summarize number fields and display a total:, but neither one of them work to display the Total field:

<!-- @@Formula: (Integer.parseInt(issue.get("customfield_12919")) != null ? Integer.parseInt(issue.get("customfield_12919")) : 0)

+ (Integer.parseInt(issue.get("customfield_12920")) != null ? Integer.parseInt(issue.get("customfield_12920")) : 0)

+(Integer.parseInt(issue.get("customfield_12921")) != null ? Integer.parseInt(issue.get("customfield_12921")) : 0)

+(Integer.parseInt(issue.get("customfield_12922")) != null ? Integer.parseInt(issue.get("customfield_12922")) : 0)-->

 

<!-– @@Formula:(issue.get(“customfield_12919”) != null ? issue.get(“customfield_12919”) : 0)+(issue.get(“customfield_12919”) != null ? issue.get(“customfield_12919”) : 0)+(issue.get(“customfield_12920”) != null ? issue.get(“customfield_12920”) : 0)+(issue.get(“customfield_12921”) != null ? issue.get(“customfield_12921”) : 0)+(issue.get(“customfield_12922”) != null ? issue.get(“customfield_12922”) : 0)

-->

2 answers

0 votes
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 10, 2018

The formula should be the second one you posted:

<!-- @@Formula:

return (issue.get("customfield_12919") != null ? issue.get("customfield_12919") : 0)
+(issue.get("customfield_12920") != null ? issue.get("customfield_12920") : 0)
+(issue.get("customfield_12921") != null ? issue.get("customfield_12921") : 0)
+(issue.get("customfield_12922") != null ? issue.get("customfield_12922") : 0);
-->

if they are all Number type custom fields. I don't see any reason why it would not work - unless of course you didn't put the formula in the field's description.

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 10, 2018

Note that I had to fix the double quotes, which were not regular double quotes in your code snippet.

Gene Kushnir March 10, 2018

Just tried and it is still not working...

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 10, 2018

Unfortunately, without access to the Jira logs, there isn't much you can do to figure out why this formula is not working.

Eugene Kushnir March 14, 2018

Just received the log file, but was not able to find any exception or other error associated with this action... is there any specific message, or keyword?

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 14, 2018

Just to make sure you put the formula in the right place, try replacing the while formula with just "1":

<!-- @@Formula: 1
-->

and see if you see the value for the field. If not, it means you put this HTML comment in the wrong place. Are you creating a Calculate Numer Field? Are you putting the code in the description of that field?

0 votes
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 7, 2018

Did you look for errors inside theJira logfile (atlassian-jira.log)?

Eugene Kushnir March 7, 2018

no... how to get there?

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 7, 2018
Eugene Kushnir March 9, 2018

I don't have server access...:(

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 10, 2018

Fair enough. 

Both of your formula are incorrect, but I can try to give you a working one. 

What is the type of each custom field you're referencing in the formula?

Gene Kushnir March 10, 2018

Thanks, They are number fields...

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events