Why isn't Calculated Number Field visible

Peter Kollmeyer June 6, 2016

I have created a Calculated Number field with the following formula:

<!-- @@Formula: (issue.get("customfield_11400") != null ? issue.get("customfield_11400") : 0) + (issue.get(“customfield_11401”) != null ? issue.get(“customfield_11401") : 0) -->

The fields within the equation are assigned to the Prioritization Screen, while the Calculated Number Field is assigned to the Default/Important Screens of issues.  I did this as I read that the Calculated Number Field can not exist on the same screen as the fields which it pulls from.  Is that correct?

 

I have the Calculated Number Field associated with a Development Project as well as a Service Desk Project (test project).  I read on one board that the Calculated Number Field will not work on a Service Desk Project.  Is that correct?

 

How to I make this field appear?  Is my equation wrong?  Am I associating the field with the wrong screen?  Any help with this will be greatly appreciated.

 

Finally, the above formula is a test formula to ensure that my set up is correct.  I eventually want to have a much more complex formula:

<!-- @@Formula: ((issue.get("customfield_11400") != null ? issue.get("customfield_11400") : 0) * .1) + ((issue.get(“customfield_11401”) != null ? issue.get(“customfield_11401") : 0) * .1) + ((issue.get(“customfield_11402”) != null ? (issue.get("customfield_11402") : 0) * .1) + ((issue.get(“customfield_11403”) != null ? issue.get("customfield_11403") : 0) * .15) + ((issue.get(“customfield_11404”) != null ? issue.get("customfield_11404") : 0) * .15) + ((issue.get(“customfield_11405”) != null ? issue.get("customfield_11405") : 0) * .1) + ((issue.get(“customfield_11406”) != null ? issue.get("customfield_11406") : 0) * .3) / (issue.get(“customfield_11407”) != null ? issue.get("customfield_11407") : 0) -->

Will this formula work, or do I need to bracket in everything from customfield_11400 through customfield_11406?  I am trying to make a scorecard for development projects.

4 answers

0 votes
Peter Kollmeyer June 23, 2016

Found the Solution internally.  The reason that the field was not visible on the screens that it was assigned to was because the Text Style Formatting of some of the quotation marks.  I had written on the formula in a text document and copied and pasted the formula into the Custom Field Description.  Upon that action, it carried some style formatting from the text document that the code did not recognize.  Once discovered, the simple formula was able to work.  The second issue that came up was the null value of the final field of the complex formula.  That came down to the mathematical function that you CANNOT divide by 0, as such the formula failed.  We set the default value of the field to "1" and made the Null value "1".  Field is up and operational.  Project in JIRA are using it.

0 votes
Peter Kollmeyer June 10, 2016

What should the "Search Template" be set to.  Currently mine is set for <Number Range Searcher>, should it be <None>?

0 votes
Peter Kollmeyer June 10, 2016

I updated the calculation to:

&lt;!-- @@Formula: int i = (issue.get("customfield_11400") != null ? Integer.parseInt(issue.get("customfield_11400").toString()) : 0) + int i = (issue.get(“customfield_11401”) != null ? Integer.parseInt(issue.get(“customfield_11401").toString()) : 0) --&gt;

I saw on a different board that that might work.  I still can't get the field to appear.  The message I receive when I click on "Where's my field" is "The field 'A Test Calculation' does not have value for issue TPFD-1 and will not be displayed on the view issue page. Set value for that field so that it shows up."  This doesn't make sense to me as I have values in the two fields (10 & 10 respectively) and the field is set to to the simple addition equation.  

I have checked the logs and can't see a reason why the field is not appearing.  I really need this field to start working and appearing.  It is not associated with the same screen as the fields it is calculating.  

Any advice?

0 votes
Steven F Behnke
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 7, 2016

Are you watching the Application log while you're writing JAVA into these fields? I'm sure you're just running into a simple error and the add-on will be very verbose about any issues you're receiving.

I also tagged your question with the add-on in question because otherwise David Fischer won't know you're asking about his add-on. 

Suggest an answer

Log in or Sign up to answer