Convert Erp.Tablesets to System.Data.DataSet

I am trying to write a function that returns a DataSet and have created the signature of my function to have the response parameter be a DataSet. When I am in the design of the function, I am invoking Erp.SalesOrder.GetByID which returns a TableSet.

Is there a way to insert/copy the TableSet into the DataSet?
Should I be using a different method?

Any help is greatly appreciated.

I don’t have an example but a dataset is a collection of data tables. Perhaps you’ll need to take the data tables from your table set and insert those as data tables into your data set

Where do you call this method!? In bpm, customization?
Epicor. ServiceModelbassembly contains several helper functions to copy TS to DS and back.

2 Likes

Thanks Aaron. I’ve tried and have not been able to successfully copy the table into the dataset. It is more than likely user error than anything else.

Olga, I am in Epicor Functions Maintenance. I am trying to create a function that has the OrderNum as the input with the OrderTableset as the output. I plan on using this in multiple data directives.

Olgas suggestion is probably the right one since functions are server side and will have that helper class available

Not sure why you want dataset there, but for example, look into Ice.DatasetAdapter.ConvertToGenericDataset from Epicor.ServiceModel assembly.

3 Likes

Example:

DataSet ds = new DataSet();
ds= DatasetAdapter.ConvertToGenericDataset(this.resultHolder.Original, "", null, true);
5 Likes

@Olga , the reason why I am trying to do this is so I will have OrderDtl data available for a Data Directive on the OrderHed table. I may be doing things incorrectly as I am a hack. :laughing: :rofl: :upside_down_face: But this is the best way that I could think of as I am working in a multi-tenant environment.

@hkeric.wci, thanks for the screenshot and example :+1:

1 Like

Where is this screenshot from?

Decompiler… dnspy, dotpeek(my choice). :wink:

1 Like

Ok. Which file should I get decompiled and where it should be?

It can be found within your client folder. Epicor.ServiceModel.dll

2 Likes