Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread new bug in insert
Wed, Mar 17 2021 8:13 PMPermanent Link

erickengelke

As shown in the included code, there may be a minor bug in the TDataSet insert routine of EWB3.

If you insert(False), it is supposed to insert at the current position,  and I used .first to put it at the start, but instead it appends to the end of the dataset.

The same code fails under EWB 2.06 too.  Am I missing something?  

Have a good day,
Erick
EWB Programming Books and Component Library
http://www.erickengelke.com



Attachments: test.zip
Mon, May 10 2021 8:52 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Erick,

<< As shown in the included code, there may be a minor bug in the TDataSet insert routine of EWB3.

If you insert(False), it is supposed to insert at the current position,  and I used .first to put it at the start, but instead it appends to the end of the dataset.

The same code fails under EWB 2.06 too.  Am I missing something?   >>

Yes, the Append parameter for the Insert method only applies to what happens to the dataset during the insertion process, not what happens to the row *after* the row is saved and the dataset is actually updated.

Your example is inserting, updating the data, and then saving the data, so what you're seeing is the end result: the row being moved to its proper position in the dataset according to the current sort order.  If there isn't an explicit sort order in a dataset, then EWB will use the (ascending) row ID as the sort order.

Tim Young
Elevate Software
www.elevatesoft.com
Image