Window.OPEN('Progress\@1@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'); TableID := DATABASE::"G/L Entry"; FromRecRef.OPEN(TableID,FALSE,'COMPANY1'); ToRecRef.OPEN(TableID,FALSE,'COMPANY2'); AllEntries := FromRecRef.COUNT; CurrEntry := 0; IF NOT FromRecRef.FIND('-') THEN EXIT; FieldsCount := FromRecRef.FIELDCOUNT; REPEAT CurrEntry += 1; PercentDone := CurrEntry / AllEntries; PercentDone *= 10000; Window.UPDATE(1,ROUND(PercentDone,1)); ToRecRef.INIT; FOR CurrFieldIndex := 1 TO FieldsCount DO BEGIN FromFieldRef := FromRecRef.FIELDINDEX(CurrFieldIndex); ToFieldRef := ToRecRef.FIELDINDEX(CurrFieldIndex); ToFieldRef.VALUE := FromFieldRef.VALUE; END; ToRecRef.INSERT; UNTIL FromRecRef.NEXT=0; Window.CLOSE;
Comments
Also have you tried and used newer version of the client to compare the performance.
I'm guessing you are comparing it to a record variable.
What is the time difference betwen recordref and record for 20K records?
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
FromRecRef.SETVIEW;
ToRecRef.SETVIEW;
and in your loop try:
ToRecRef.FIELDINDEX(CurrFieldIndex).VALUE := FromRecRef.FIELDINDEX(CurrFieldIndex).VALUE
So my recommendation here is to use COUNTAPPROX instead of COUNT. It should speed up the process.
Also you can move this calculation below the exit criteria check. The code will look like this:
IF NOT FromRecRef.FIND('-') THEN
EXIT;
AllEntries := FromRecRef.COUNTAPPROX;
CurrEntry := 0;
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.