Calculated Number field

Please see the calculated number field we need written below. I would love some help in writing the script to accomplish what we would like to accomplish. Column A (A-G) are the fields. Columns B-F are the options that can be entered for the given field. And the last row (Total Marks in Category) is multiplied by a given number depending upon what is entered as an option for the given field. Please let me know if there are any questions.

9 answers

This widget could not be displayed.

Here is a zommed in version of the original image I included.

This widget could not be displayed.

What are you planning to use to calculate this?

This widget could not be displayed.

I did some research and downloaded this add-on which allows you to use a "Calculated Number Field"

https://marketplace.atlassian.com/plugins/com.innovalog.jmcf.jira-misc-custom-fields

This widget could not be displayed.

You could also try Script Runner, there is an example of the principal of what you are trying to do here: https://jamieechlin.atlassian.net/wiki/display/GRV/Scripted%20Fields#ScriptedFields-Calculateanumberbasedonotherfields

This widget could not be displayed.

Here is what I have so far for the calculated number field. Can someone please take a look and help me out with this?

<!-- @@Formula:

issue.get("customfield_13603") != null ?

if (value === 6)

return (value * 2);

if (value === 7)

return (value * 2);

if (value === 8)

return (value * 2);

if (value === 9)

return (value * 2);

if (value === 10)

return (value * 2);

-->

This widget could not be displayed.

Hey Campbell,

We just spoke on the phone. Regarding your questions about the Calculated Number Field custom field from the JIRA Misc Custom Fields, you can get further help from Innovalog's Support team please see this Getting Support page. :)

Cheers,
Matheus

I have just edited your question to add this add-on's tag so that the Innovalog team can see it.

This widget could not be displayed.

As of now I am only worrying about Field A (Eventually we are going to create Fields B-G). So let's just say I have created 1 custom field for now. This field is a radio button field with 5 options: 0, 1-5, 6-10, 11-15, and 16-100). The 1's in the cells mean that the user is selecting one of these options. I understand the 1 can be confusing (I didn't create the spreadsheet), so I would just think of it is a checkbox.

This widget could not be displayed.

If O understand correctly, you have created 7 custom fields on your issues, named "A" to "G". What is the field type of these fields?

Also, I don't understand your Excel spreadsheet. What do the "1"s in the cells mean? I would assume that your fields are of type "Select", and you have created possible values equal to "0 (default)", "1-5", etc. Right? And thus the user can select a value for each field?

This widget could not be displayed.

You might want to try something like:

Option val = issue.get("customfield_13603")
if (val == null)
  return null;
if (val.getValue().equalsIgnoreCase("0 (default)"))
  return 0;
if (val.getValue().equalsIgnoreCase("1 - 5"))
  return 1;
...

Thanks David for getting back to me. I have entered in what you have suggested and nothing is being populated into the field. I am not sure what is wrong because there are no error messages or anything.

Did you look into your logs for errors? Try displaying the issue with the field and then immediately look at the log. It should tell you if you have a syntax error.

Great, thanks. Can you let me know where exactly in the logs I should be looking?

Any time you try to actively use the field. Best thing to do is have a browser and a terminal open next to each other on your computer.

On the terminal, be tailing the log, so you're seeing it as Jira writes to it.

In the browser, edit an issue on-screen.

Any output the field throws into the log will be instantly echoed. (I've used the "edit" action as it's the most llikely to get the field's code to be called)

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted yesterday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

64 views 1 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you