Reputation: 1
I want to export data from data window into excel sheet with customized column order, what is the syntax for that? For ex: In my data window I have data in the order ID/Name/DOB/City. But I want to import in order Name/ID/DOB/City
Upvotes: 0
Views: 5261
Reputation: 1
Here is the solution,
datastore lds_datastore
lds_datastore = CREATE datastore
lds_datastore.DataObject = "d_student_filter"
lds_datastore.SetTransObject (SQLCA)
lds_datastore.Retrieve()
long ll
ll = dw_filter.Sharedata(lds_datastore)
IF ll > 0 THEN
lds_datastore.Saveas("c:\Document\export.xls",Excel!,TRUE)
END IF
Upvotes: 0
Reputation: 2407
There are a few ways to do this. One way is via a second datastore which is populated via the ShareData method. This second datastore would use a datawindow object set up with the same columns as in the original datawindow but in the order you wish to have them in the export. Code example for this:
int li
li = dw_primary.Sharedata(ds_excelexport)
IF li > 0 THEN
dw_excelexport.Saveas("c:\temp\export.xls",Excel!,TRUE)
END IF
Upvotes: 1
Reputation: 6225
There’s nothing automagic that can do that. Two options that I can think of:
In terms of runtime performance, I’d expect the second option will be faster, especially as the data set gets larger.
Good luck.
Upvotes: 0