Hi there,
I've developed a process which has to read/write millions of records and unluckily takes centuries. (Its well known that NAV work with cursos and some cases is not really effective)
This is my code: (it's a easy loop)
IF Header.FINDFIRST THEN
REPEAT
BufferHeader.TRANSFERFIELDS(Cta);
BufferHeader.INSERT;
Lines.SETRANGE("Header No.",Header."No.");
IF Lines.FINDFIRST THEN
REPEAT
BufferLine.TRANSFERFIELDS(Lines);
BufferLine.INSERT;
UNTIL Lines.NEXT = 0;
UNTIL Header.NEXT = 0;
IF PostedHeader.FINDSET THEN
REPEAT
BufferHeader.TRANSFERFIELDS(PostedHeader);
BufferHeader.INSERT;
PostedLine.SETRANGE("Header No.",PostedHeader."No.");
IF PostedLine.FINDFIRST THEN
REPEAT
BufferLine.TRANSFERFIELDS(PostedLine);
BufferLine.INSERT;
UNTIL PostedLine.NEXT = 0;
UNTIL PostedHeader.NEXT = 0;
As you can see I'm inserting the records in a buffer. Do you know if its possible to speed this up? Maybe storing in the buffer table directly from sql, do you recommend me that??
Thanks
I've developed a process which has to read/write millions of records and unluckily takes centuries. (Its well known that NAV work with cursos and some cases is not really effective)
This is my code: (it's a easy loop)
IF Header.FINDFIRST THEN
REPEAT
BufferHeader.TRANSFERFIELDS(Cta);
BufferHeader.INSERT;
Lines.SETRANGE("Header No.",Header."No.");
IF Lines.FINDFIRST THEN
REPEAT
BufferLine.TRANSFERFIELDS(Lines);
BufferLine.INSERT;
UNTIL Lines.NEXT = 0;
UNTIL Header.NEXT = 0;
IF PostedHeader.FINDSET THEN
REPEAT
BufferHeader.TRANSFERFIELDS(PostedHeader);
BufferHeader.INSERT;
PostedLine.SETRANGE("Header No.",PostedHeader."No.");
IF PostedLine.FINDFIRST THEN
REPEAT
BufferLine.TRANSFERFIELDS(PostedLine);
BufferLine.INSERT;
UNTIL PostedLine.NEXT = 0;
UNTIL PostedHeader.NEXT = 0;
As you can see I'm inserting the records in a buffer. Do you know if its possible to speed this up? Maybe storing in the buffer table directly from sql, do you recommend me that??
Thanks