Dojo Script for division || for Customized dicimal fileds
Hi, I am able to use Dojo Script for addition and multiplication, but now sure how to do a division for e.g. I am using a script for addition field1 + filed 2, (10 +2=14) but not able to do filed1/filed2 , ( 10/2=5). <o:p> </o:p> please suggest. |
One answer
Hi,
I tried a simple code here and the division works normally.
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.
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.