Print Thread
Copy SQL or Copy Dataset
#8744 10/17/06 05:25 AM
Joined: Apr 2004
Posts: 8
San Antonio, TX
H
Hawkeye Offline OP
Member
OP Offline
Member
H
Joined: Apr 2004
Posts: 8
San Antonio, TX
I have a wizard we created that exports the contents of a dataset to Excel. The wizard allows the user to select the columns, change the filter, change the column headings prior to performing the export. Currently, we are limited to exporting a table (or materialized view). I would like to be able to pass a dataset or fully Substituted SQL statement into the wizard. In a test I tried using the .SubstitutedSQL property but received an error stating that not all variables are defined
Ex:
NewDataset.SQL.AddStrings(OldDataset.SubstitutedSQL);
NewDataset.Active := True;
Error occurred.

One can assume that all the passed in datasets will have at least one variable.

In a post titled "Assign a toracledataset to another? " dated 15 September, 2003, ziller asked [quote]is there a way to clone a toracledataset ? i mean myrorads2.assign(myorads1);[/quote]and you responded with [quote]You will have to assign the individual properties to copy the dataset. All properties can be assigned though, even properties such as Variables, QBEDefinition, and so on.[/quote]Do I have to assign every single dataset properties or can I assign only those that might differ between the two datasets. For example, NewDataset.Variables.Assign(OldDataset.Variables) and NewDataset.SQL.Assign(OldDataset.SQL). If I don't need to assign them all can you suggest which ones I should always assign?

Thanks
Richard Anderson

Re: Copy SQL or Copy Dataset
#8745 10/17/06 09:30 PM
Joined: Aug 1999
Posts: 22,208
Member
Offline
Member
Joined: Aug 1999
Posts: 22,208
You can assign just the properties that are different. Instead of using assign, you can simply do the following:

NewDataSet.Session := OldDataSet.Session;
NewDataSet.SQL := OldDataSet.SQL;
NewDataSet.Variables := OldDataSet.Variables;

This would be the minimum set of properties you need to assign.


Marco Kalter
Allround Automations

Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.056s Queries: 13 (0.017s) Memory: 2.4973 MB (Peak: 3.0380 MB) Data Comp: Off Server Time: 2024-05-06 05:28:00 UTC
Valid HTML 5 and Valid CSS