How to pass a dataset into a function

Does anyone know how exactly we’re supposed to be using the System.Data.Dataset type as an input to a function? The function has this as an option but I have been unable to find any documentation on the syntax it’s expecting. Looking at it on swagger just shows it as a string input parameter? Am I expected to just pass the whole dataset as a string inside the object and manually parse it in the function?

image

image

You pass in a JSON Escaped Serialized DataSet so a dataset like this

{"Table1":[{"ID":1,"Name":"Alice"},{"ID":2,"Name":"Bob"}],"Table2":[{"ID":1,"Product":"Laptop"},{"ID":2,"Product":"Smartphone"}]}

Should look something like this

{\"Table1\":[{\"ID\":1,\"Name\":\"Alice\"},{\"ID\":2,\"Name\":\"Bob\"}],\"Table2\":[{\"ID\":1,\"Product\":\"Laptop\"},{\"ID\":2,\"Product\":\"Smartphone\"}]}
``

My suggestion, take an existing order, grab its SalesOrderDataSet, then push it through Ice.DatasetAdapter.ConvertToGenericDataset() and look at it in Swagger/Postman. Then mimic it for your function.

Alternatively (and probably more straightforward), use a UpdExtSalesOrderTableset from the “Select Type…” drop down. You can also use a plain SalesOrderTableset, but those can be a bit more finnicky and as a general rule I use the UpdExt tablesets when importing from outside the system.
image

image

Either way, you’re going to end up sending serialized JSON text to the function. Using the pre-defined Tablset will save you time since the system already knows what it should look like so you don’t have to define it yourself.

2 Likes

Thanks.

Thanks I’ll try this.