Kepler Custom fields - SIL Script custom field

Karthick Sambasivam September 13, 2014

Could you please help me out on the below request?

 I have a field called 'Value1' and another field called 'Value2'. Both are Select list custom fields with numbers from 1 to 5. When I create an issue, let's say I will select '3' in field Value1 and '4' in field Value2, I want the script to multiply those two values and display the result (12) in another field called 'Result'.

7 answers

1 accepted

1 vote
Answer accepted
Alexandru_Iacob
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.
September 14, 2014

Hi Karthick,

Try setting the following SIL script to your SIL cf:

number x =  customfield_xxxxx;

number y = customfield_yyyyy;

return x*y;

SIL will automatically cast the two custom field values to numeric values and will do the correct calculation, assuming you only have values from 1 to 5 in the two select lists..

Kind Regards,

Alex

Norman Abramovitz
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.
September 14, 2014

How do you know the custom field values? They should be different based upon what custom fields are actually being used.

Alexandru_Iacob
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.
September 14, 2014

Yes, the values I provided were only an example. You should replace with your own custom field ids. I updated the example with more generic example.

Norman Abramovitz
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.
September 14, 2014

Do you remember where to find those values? I do not have access to a JIRA system until later today.

Alexandru_Iacob
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.
September 14, 2014

You can see the custom field ids from the Custom Fields administration section. Go to the desired custom field and hover the Configure link from the right drop-down. You should see the custom field id displayed as parameter in the url.

0 votes
Karthick Sambasivam September 14, 2014

Alexandru, Thank you so much. It works.

0 votes
Norman Abramovitz
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.
September 14, 2014

If you look in your JIRA log, you should see error messages.   I know you are not addressing the custom fields correctly because the name should be customfield_<number>.   What I don't remember is how to get you the number.  It should be in the JIRA screen where you defined value1 and value2.

http://confluence.kepler-rominfo.com/display/SIL/Variable+Resolution  (see the section about custom fields)

 

 

 

0 votes
Karthick Sambasivam September 13, 2014

Hi,

I have tried many but nothing works. I am not good in coding.

return (Value1 * Value2)

0 votes
Karthick Sambasivam September 13, 2014

Hi,

I am using JIRA and created a new SIL Script custom field type and named as 'Result'. I would like to write a code in the new field created to multiply values from Value 1 and Value 2 select list custom field types.

Norman Abramovitz
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.
September 13, 2014

Please show me your SIL code?

0 votes
Norman Abramovitz
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.
September 13, 2014

The only the calculated field (result) would be a Kepler Custom field.    How are you defining the value1 and value2?  Are you using JIRA or are you going to use a Kepler Database Custom fields?   Yes, a Kerpler Database Custom field is a different plugin from Kepler Custom fields.

http://confluence.kepler-rominfo.com/display/DBCF/User+Guide

http://confluence.kepler-rominfo.com/display/KCF/User+Guide

 

0 votes
Norman Abramovitz
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.
September 13, 2014

What parts do you have working and what parts are you struggling with?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events