Javascript Summation does not work | Community
Skip to main content
Level 2
March 7, 2022
Solved

Javascript Summation does not work

  • March 7, 2022
  • 1 reply
  • 786 views

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;

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Anish-Sinha

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

1 reply

Anish-Sinha
Adobe Employee
Anish-SinhaAdobe EmployeeAccepted solution
Adobe Employee
March 7, 2022

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

Level 2
March 7, 2022

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

Anish-Sinha
Adobe Employee
Adobe Employee
March 8, 2022

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