CRBatchMove with VirtualTable and mode bmAppendUpdate

Discussion of open issues, suggestions and bugs regarding Virtual Data Access Components for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Nono
Posts: 4
Joined: Tue 05 Oct 2010 06:52

CRBatchMove with VirtualTable and mode bmAppendUpdate

Post by Nono » Tue 12 Oct 2010 12:07

Hi,

I am using the CRBatchMove from UNIDAC to move data from a TQuery to a TVirtualTable.

I would like to use the bmAppendUpdate mode so that I wouldn't have two same rows in the virtualTable. Here is my code :

Code: Select all

         CRBatchMove1.Mode:=bmAppendUpdate;
         CRBatchMove1.Source:=MyTQuery;
         CRBatchMove1.Destination:=MyTVirtualTable;
         CRBatchMove1.Execute;
The problem is that the bmAppendUpdate mode doesn't seem to work with the TVirtualTable because I have several same data in the table. It seems to be in bmAppend mode instead.

For Example, I could have :

Code: Select all

NO_ID    |    Description
--------------------------------
   1         |   Desc1
--------------------------------
   2         |   Desc2
--------------------------------
   2         |   Desc2
--------------------------------
   2         |   Desc2
And I would like to have

Code: Select all

NO_ID    |    Description
--------------------------------
   1         |   Desc1
--------------------------------
   2         |   Desc2
How can I make it work?

Thank you very much

AndreyZ

Post by AndreyZ » Wed 13 Oct 2010 12:32

Hello,

You can't use the bmAppendUpdate mode for the TVirtualTable component because in this mode you need a unique key for destination Dataset. And TVirtualTable doesn't support unique keys. Is using the "distinct" keyword in a query inappropriate for you?

Nono
Posts: 4
Joined: Tue 05 Oct 2010 06:52

Post by Nono » Fri 15 Oct 2010 12:09

Thank you for the answer. I'll find another solution :)

The DISTINCT query is not possible because the data which are in the VirtualTable come from different tables so It won't work in my case but thanks for the idea.

Post Reply