In order to reduce the use of the calculation event in a repeating subform, I have set up a function (riskRating) in a script object (calculateRisk), which the exit event of a dropdown (RA_severity) calls.
var vLikelihood = RA_likelihood.rawValue; //dropdown list 1 var vSeverity = RA_severity.rawValue; //dropdown list 2 var vRisk;
console.println("Risk after function = " + vRisk);
RA_risk_rating.rawValue = vRisk; //this line is meant to assign the value of vRisk from the function to another field (but it doesn't)
//This is the function within calculateRisk script object...
Take a look at the attached. The form contains four numeric fields: 'a', 'b', 'total', and 'other'. It does a calculate on fields 'a' and 'b'. On the exit event of 'b' it calls 'addNumbers()' in 'MyScriptObject'. The function updates 'total' and returns the value of 'total' to be bound to 'other'.