Page 1 of 1

CRBatchMove with VirtualTable and mode bmAppendUpdate

Posted: Tue 12 Oct 2010 12:07
by Nono
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

Posted: Wed 13 Oct 2010 12:32
by AndreyZ
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?

Posted: Fri 15 Oct 2010 12:09
by Nono
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.