Expand my Community achievements bar.

SOLVED

Javascript Summation does not work

Avatar

Level 2

Hello, 

 

Javascript Summation is not working. Please help.

var i;
var lv_surTot1 = 0;
var lv_surTot2 = 0;

for (i = 0; i < (lt_prcom.length); i++) {
var lv_TC = lt_prcom.item(i).resolveNode("TypeCode").value;
var lv_mlonv = lt_prcom.item(i).resolveNode("MajorLevelOrdinalNumberValue").value;
if (lv_mlonv!= "850") {

var lv_CA = lt_prcom.item(i).resolveNode("CalculatedAmount").value;
if (lv_CA != null) {
lv_tot = lv_tot - lv_CA;

if (lv_TC == "ZSUR"){
lv_surTot1 = lv_surTot2;
lv_surTot2 = lv_CA;
lv_surTot1 = lv_surTot2 + lv_surTot1;
}

 

}
}
}

this.decSurTotAmt.rawValue = lv_surTot1 + 0.00;

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

I did try the script by putting the random values and it does execute. What is the error you see?

View solution in original post

3 Replies

Avatar

Correct answer by
Employee Advisor

I did try the script by putting the random values and it does execute. What is the error you see?

Avatar

Level 2

Hello,

 

I don't get any error but the sum is not working.

Individually, each of these variables when printed are displaying the values.

lv_surTot1 = lv_surTot2 + lv_surTot1;    

 

The sum is not working.

Thanks,
Srini

Avatar

Employee Advisor

the syntax is correct. Try executing on some other platform first and check.