Dojo Script for division || for Customized dicimal fileds
One answer
Hi,
I tried a simple code here and the division works normally.
return workItem.getValue("test_num_1")/workItem.getValue("test_num_2");
Try to use a try/catch to see if there is some exception... Like this:
getValue: function(attribute, workItem, configuration) {
try {
var num1 = workItem.getValue("test_num_1");
var num2 = workItem.getValue("test_num_2");
var sum = 0;
if (!isNaN(num1) && !isNaN(num2)) {
sum = num1/num2;
} else {
sum = "";
}
return sum;
} catch (err) {
return err.message;
}
}
You might want to use the Number() method to force/parse the value into a Number value.