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
Gastón Salomone
Hi, I cannot find any information on about this feature on hansamanual. That is the purpose, is it working, how it works or how must be configured to work ? For REST API many web request per...
23:47 3 Oct 2024
Paul Timms
Thanks Bror-Erik, it's hard to replicate so we won't know for sure until we upgrade the customer with this issue....
10:37 30 Sep 2024