Hi,
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.
//This is the Javascript in the exit event...
var vLikelihood = RA_likelihood.rawValue; //dropdown list 1
var vSeverity = RA_severity.rawValue; //dropdown list 2
var vRisk;
calculateRisk.riskRating(vLikelihood, vSeverity);
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...
function riskRating(vLikelihood, vSeverity)
{
var vRisk;
if (vLikelihood == null && vSeverity == null)
{
vRisk = null;
}
else
{
vRisk = vLikelihood * vSeverity;
}
console.println("Risk inside function = " + vRisk);
return vRisk;
}
I have tried various approaches to get the answer back out of the function and to be used for the remainder of the script in the exit event script.
The console show the correct calculation in the function, but it is not updating the variable outside of the function.
Any ideas?
Thanks,
Niall