It is in a big solution now, I'll see if I can build a small sample this evening.
The looping over a foundset within the calculation goes wrong.
It even seems that the calculation runs twice at the same time.
Code :
- Code: Select all
function calc_verkoopprijs_totaalhn()
{
var i;
var _conr;
var _tot;
if(utils.hasRecords(bcom_full_ondh_contracten_to_ondh_contractregels))
{
_tot = 0.00;
application.output('i= ' + databaseManager.getFoundSetCount(bcom_full_ondh_contracten_to_ondh_contractregels))
for(i = 1; i <= databaseManager.getFoundSetCount(bcom_full_ondh_contracten_to_ondh_contractregels); i++)
{
_conr = bcom_full_ondh_contracten_to_ondh_contractregels.getRecord(i);
application.output('regel= , ' + i + ',' +_conr.ondhconrgl_posno + ',' + _conr.calc_netto_prijs)
if(_conr.calc_netto_prijs != null)
{
_tot += _conr.calc_netto_prijs;
}
}
return _tot;
}
else
return 0;
}
Application.output
- Code: Select all
i= 181
i= 181
regel= , 1570,
regel= , 1580,0
regel= , 1570,0
regel= , 1590,0
regel= , 1580,0
regel= , 1600,0
regel= , 1590,0
regel= , 1610,0
regel= , 1600,0
regel= , 1610,0
regel= , 1620,0
regel= , 1620,0
regel= , 1630,0
regel= , 1630,0
regel= , 1640,0
regel= , 1640,0
regel= , 1650,0
regel= , 1650,0
regel= , 1670,0
regel= , 1670,0
regel= , 1680,
regel= , 1690,0
regel= , 1680,0
...
...
Application.output gives two (same) lines where I would expect only 1.
===> the line i= 181 should only be there once before the other output
===> The same numbers appear twice, this shoud never be the case
We renamed one of the calculations and the error has gone ...
Maybe Johan has an idea where this could go wrong ?
Regards