Re: proper looping while updating
Aldevinas Katkus
10-12-23
I guess there is same bug with rental invoices: will be there wrong links depends on whether the new inoice number will be higher or lower than the old one, but I do not have rental configured and cannot check.

I will answer myself:

//proper way of updating one-to-many linked records ("on update cascade" in SQL terms)

FuelSDrsr.SDNr=oldNr;
While ReadFirstKey("SDNr",FuelSDrsr,1,true) begin
RecordCopy(oldFuelSDrsr,FuelSDrsr);
FuelSDrsr.SDNr=newNr;
if (RecordUpdate(oldFuelSDrsr,FuelSDrsr,false)==0) then begin end;
ResetLoop(FuelSDrsr);//Is it necessary?
FuelSDrsr.SDNr=oldNr;
end;
Leave Comment
You can subscribe to notifications for this post by selecting the 'star' icon on the top right corner of the post.
Latest Posts
Gatis Jansons
Hi, Piotr. There is a setting in general about refreshing: TC >> Timed Operations >> Seconds Between Browse Updates But it does not cover Task Manager. However there is an appr...
14:46 14 May 2024
Aldevinas Katkus
Actually a new version of this bug is SL>>Reports>>Periodic customer statement "accumulates" amounts Not sure why it was duplicated, I clicked "submit"only once....
08:09 10 May 2024