process all records in sorted dataset
Posted: Mon 07 Jun 2021 13:16
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.
Thanks for ideas. I have the only one - set indexfieldnames before this iteration to empty string, but i don't find this nice...
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;