Page 1 of 1

process all records in sorted dataset

Posted: Mon 07 Jun 2021 13:16
by Ludek
Hi, do you have a recommended way to process all records in sorted dataset? Especially how to handle the situation, when the field, that is included in indexfieldnames, has to be changed.

typically, such code does not process the whole dataset, but only the (initially) first record - because with the first ".post" it jumps to last position (because of active sorting) and the next ".next" call activates eof and the iterations stops.

Code: Select all

dataset.indexfieldnames := 'somefield';
dataset.first;
while not dataset.eof do begin
  dataset.edit;
  datasetsomefield.asinteger := maxint;
  dataset.post;
  dataset.next;
end;
Thanks for ideas. I have the only one - set indexfieldnames before this iteration to empty string, but i don't find this nice...

Re: process all records in sorted dataset

Posted: Thu 12 Aug 2021 07:12
by Stellar
Hi there,

When the data in the locally sorted dataset is changed the recordset is automatically sorted.
To solve this issue, you may sort data on server, or make changes on the server, and then update the dataset.

Regards,
Sergey