We have two single select fields with options like cf1val1, cf1val2, cf2,val1, cf2val2 and so on. I have a 3rd custom field as Calculated number field. On this number field I want numbers based on selection of the two field options.
Assume values as mentioned below
cf1val1 & cf2val1 - 1
cf1val2 & cf2val2 - 2
When cf1val1 & cf2val1 are selected, the calculated number field should have value 1*1=1
When cf1val1 & cf2val2 are selected, the calculated number field should have value 1*2 =2
I tried with formula as mentioned below, but could not get the output. No luck.
<!-- @@Format:
if ( (issue.get("customfield_23141").getValue().equals("cf1val1")) && (issue.get("customfield_23142").getValue().equals("cf2val1")) )
return 1;
if ( (issue.get("customfield_23141").getValue().equals("cf1val1")) && (issue.get("customfield_23142").getValue().equals("cf2val2")) )
return 2;
-->
Also in logs i get this error "[innovalog.jmcf.fields.CalculatedNumberField] CalculatedNumberField: could not find formula in custom field description" even though I put the above formula in description of the calculated field. Kindly help on this.
The formula needs to be put in the field description, not field configuration description. You need to choose edit, not configure in the field actions pop-up menu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm afraid you confused @@Format with @@Formula. You want the latter.
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
David, I changed it to @@Formula still did not get the required outcome. I am not able to see the field on view screen when the issue is created. I double checked and confirmed that it is configured in the screen. Also I tried below code and the same did not work too. Please let me know if any modifications need to be done and suggest the same over here. <!-- @@Formula: Object cf1 = issue.get("customfield_23141"); Object cf2 = issue.get("customfield_23142"); int mult = 0; int nult = 0; if( cf1 != null && !cf1.toString().equals( "cf1 value1" ) ) { mult = 1; } if( cf1 != null && !cf1.toString().equals( "cf1 value2" ) ) { mult = 2; } if( cf2 != null && !cf2.toString().equals( "cf2 value1" ) ) { nult = 1; } if( cf2 != null && !cf2.toString().equals( "cf2 value2" ) ) { nult = 2; } int number = mult * nult; return number; -->
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you look inside altiassian-jira.log for errors? Search for "innovalog". Also, what do you mean by "view screen when the issue is created"? Do you mean on the Issue Creation screen or on the view screen after you've created the issue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes I am not able to view the calculated field on the view screen which we get after the issue gets created. Yes I looked into the logs and found below errors same as mentioned in description. 2015-01-03 00:43:08,391 http-17000-23 WARN ikkhan 43x4803x1 1xozqbn 10.19.0.17,10.253.96.191 /browse/IKK-34 [innovalog.jmcf.fields.CalculatedNumberField] CalculatedNumberField: could not find formula in custom field description 2015-01-03 00:43:08,404 http-17000-23 WARN ikkhan 43x4803x1 1xozqbn 10.19.0.17,10.253.96.191 /browse/IKK-34 [innovalog.jmcf.fields.CalculatedNumberField] CalculatedNumberField: could not find formula in custom field description I have put in above formula in Custom field description in "Field Configuration".
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.