I am building my first Data-access class using a ProDataSet
What I was attempting is something like this:
First get all the main customer information
METHOD PUBLIC VOID GetCustomerData( INPUT pFilter AS CHARACTER, OUTPUT DATASET dsCustomer): DATASET dsCustomer:EMPTY-DATASET. THIS-OBJECT:CustomerDataSource:attach(BUFFER ttCustomer:HANDLE, pFilter). THIS-OBJECT:CustomerAddressDataSource:attach(BUFFER ttCustomerAddress:HANDLE). THIS-OBJECT:CountryDataSource:attach(BUFFER ttCountry:HANDLE). THIS-OBJECT:CountryTranslationDataSource:attach(BUFFER ttCountryTranslation:HANDLE). DATASET dsCustomer:FILL(). THIS-OBJECT:CustomerDataSource:detach(BUFFER ttCustomer:HANDLE). THIS-OBJECT:CustomerAddressDataSource:detach(BUFFER ttCustomerAddress:HANDLE). THIS-OBJECT:CountryDataSource:detach(BUFFER ttCountry:HANDLE ). THIS-OBJECT:CountryTranslationDataSource:detach(BUFFER ttCountryTranslation:handle). RETURN. END METHOD.
After that I would like to add some more data to the dataset if it is required:
METHOD PUBLIC VOID GetMultipleData( INPUT-OUTPUT DATASET dsCustomer): // Don't empty the dataset, but add invoice data to the existing dataset. Of course we have to make sure there are customers in the dataset before calling this method THIS-OBJECT:MultipleDataSource:attach(BUFFER ttMultiple:HANDLE). DATASET dsCustomer:FILL(). THIS-OBJECT:MultipleDataSource:detach(BUFFER ttMultiple:HANDLE).RETURN.END METHOD.
When I try to run this I get an error on calling of the GetCustomerData() method, MultipleDataSource has to be attached before the dataset can be filled.
I get the error message, and the simple solution would just be to fill the entire dataset with all the data every time, but that would also imply a lot of redundant data in the dataset.
In this case there is just some basic information, but you can imagine that a customer does not only have this information, but also invoices (with invoice lines), orders (with order lines), etc...
Is it possible to just get the information and fill the temp-tables for the required data?
Else: is performance of OpenEdge ProDataSets so awesome that I do not have to worry about the extra data that is filled every time?