Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Multiplication JMWE

I am using Event based action 
i want to multiply two value for example 
issue.get("A") * issue.get("B")
I need to multiply the value in A and B
Both are an Select List (single choice) 
This is my input in groovy 
issue.get("A") * issue.get("B")

I am getting the error below:

Message:
groovy.lang.MissingMethodException: No signature of method: java.lang.String.multiply() is applicable for argument types: (String) values: [2]
Possible solutions: multiply(java.lang.Number)
Stack:
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:70)
org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)
script_26368e98e66f945a82190506d60ca4bc.run(script_26368e98e66f945a82190506d60ca4bc.groovy:1)

1 answer

1 accepted

0 votes
Answer accepted
David Fischer
Community Champion
July 22, 2022

Hi @Abdullah Sa'D Muhammad Answar Vencapah ,

issue.get applied to a Single-select field returns a String, not a number. You need to convert the string to a number first:

Integer.parseInt(issue.get("A","0")) * Integer.parseInt(issue.get("B","0"))

Suggest an answer

Log in or Sign up to answer