Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi: Is there a way to access records in a TClientDataset besides moving the cursor

Tags:

delphi

I want to append a record in a TClientDataSet based on another record (in this same TClientDataSet). Problem is that i can't access another record in the TClientDataSet because the cursor is pointed to the row i'm appending. And i can't find another way to access the other records in the same TClientDataset.

Of course i can use an extra TClientDataSet, copy some stuff and solve it that way, but i don't like that solution.

So is there a way to access the rows/records in a TClientDataset besides moving the cursor?

like image 842
Niek H. Avatar asked Sep 03 '09 07:09

Niek H.


1 Answers

The only way to do this would be to fully dissect the ClientDataSet.Data property content.

Which means you will need to write most of the ClientDataSet functionality yourself.

It is much easier to clone the cursor into a new ClientDataSet, then use that cursor to browse through your records. Then you can use your old ClientDataSet to do the appends.

This article explains about cloning cursors: Cloning ClientDatSet Cursors

--jeroen

like image 145
Jeroen Wiert Pluimers Avatar answered Sep 28 '22 08:09

Jeroen Wiert Pluimers