Groovy script to multiply two numeric
I tried below script to set value multiplication of two numbers.But i am getting below error.
“No signature of method: static java.lang.String.Multiply() is applicable for argument types: (java.lang.Integer, java.lang.Integer)”
import com.agile.api.ItemConstants;
import com.agile.api.CommonConstants;
import java.math.*;
import java.util.*;
import java.lang.*;
import com.agile.agileDSL.ScriptObj.IBaseScriptObj
// add other import statements here
void invokeScript(IBaseScriptObj obj) {
//script body starts here.
//set attributes
String v1 = obj.getValueByAttId(ItemConstants.ATT_PAGE_TWO_NUMERIC07);
String v2 = obj.getValueByAttId(ItemConstants.ATT_PAGE_TWO_NUMERIC06);
obj.setValueByAttId(ItemConstants.ATT_PAGE_TWO_NUMERIC09,String.Multiply(v1,v2) );
}
Please help me how can i do this.
Thanks in Advance…..
Here is how I do it in groovy script
// Get Risk_Number
s_Risk_Number = obj.getValueByAttId(12469);
Risk_Number = Double.parseDouble(s_Risk_Number);
//Get Risk_Multiplier
s_Risk_Multiplier = obj.getValueByAttId(12470);
Risk_Multiplier = Double.parseDouble(s_Risk_Multiplier);
//calculate Risk Score
Risk_Score = Risk_Number * Risk_Multiplier;