Copy dataset result

Hi,
I want to copy TDAMemDataTable dataset to other TDAMemDataTable dataset. I tried data2.dataset = data1.dataset that doesn’t allow to assign. If I use data2 = data1, then it will assign all things instead of dataset only. Any advise?

Hi,
Please ignore this issue. I found I can use CopyRecordSet command.
Thanks.

Hi,
I copy the dataset to another dataset and set the master detail relationship. I got the error of “Data table “Table” was not found in schema”. The another dataset need not to connect DAD schema because it likes a virtual table and improve the performance. Any advise about this?

Hi,

Looks like you have true in table.RemoteFetchEnabled

Hi,
Yes. I set false now. But CopyRecordSet will not copy all fields into new dataset. So it will have an error of fields not found.

Hi,

can you show code how to you are using it, pls?

Hi,
I use the following code to copy dataset. Then I setup Master/Detail in properties manually.

summarydb.CopyRecordSet(tbl_master,true, true);

Hi,

odd, we use CopyRecordSet in briefcases
Can you create a simple testcase that reproduces this case, pls?
you can attach it here or drop to support@ for keeping privacy

Hi,
I sent the simple testcase for you. Thanks!

Hi,

I can reproduce an issue with CopyRecordSet and detail tables.
In your case, for reports, I can recommend to use ClonedSource feature.
see the ClonedSource sample for details

Hi,
I tried to using “ClonedSource”. But it has an error “Dataset: Circular datalinks are not allowed” if I set the Master/Detail linkage.

Hi,

Do you want to use the same table for master and for detail ?

Hi,
Yes. I want to use the same table for master and for detail. Is it possible?

Hi,

No, it isn’t

What I can recommend:

  • remove all design-time m/d relations
  • CopyRecordSet
  • assign m/d relations in run-time

in this case, it should work w/o any issues.

Hi,
I should using “CloneSource” or “CopyRecordSet”. Which is better?

Hi,

CloneSource - all cloned tables and master table use the same recordset. the same recordset cannot be used as the master and the detail in the same m/d relation.
CopyRecordSet - each table has personal recordset. no limitations in m/d

Hi,
If using “CopyRecordSet”, I found all data will gone if using “dataset.Active := false” and then “dataset.Active := true”. If re-run the same criteria, all data also gone. If I use runtime to create TDAMemDataTable, then it works fine without problem.

The other issue is that I set filtered = true in source dataset and then “CopyRecordSet”. It will not copy the filtered result set to new dataset. It still copies all data to new dataset.

Hi,

this is as expected. all data is stored in memory dataset and when you close it, it also clears internal data

as expected. it is designed for copying all data.

How about this? If I’m using design component, run the first time that is OK. But run it again, the data is empty for using “CopyRecordSet”. If using runtime to create TDAMemDataTable, the data is not empty for using “CopyRecordSet”.

Hi,

you should do table.close instead of dataset.close