System.dataset.addrow change Date datatype to Unicode

The problem here seems to lie in the creating of an empty dataset with the toDataSet function and not in the addRow function. When you create a dataset with 3 columns but zero rows, every one of the columns is then defined as a string type. When you first append the data and then convert it to a dataset the function sees what types of values are in each column and then defines the dataset accordingly.

I can check on it, but I’m not sure there is much that can be done in this situation. When a dataset is created it’s columns need to have defined types.

Is there a reason you can’t pass your data in when you call the toDataSet function? If you appended at least one row of data before calling the toDataSet function then the column types would be set appropriately and when you called the addRow function after that everything would work as expected. You could even seed the dataset with a dummy row of data with the correct types and then call the deleteRow function.

A word of warning when using the setValue, addRow, deleteRow, and updateRow functions: These functions are very inefficient because the dataset is essentially copied and then recreated. Datasets are immutable and therefore cannot be modified after they are created, hence all the copying and recreating that needs to be done. If you need to do something multiple times and have all your row data before the dataset is created then it’s going to be far more efficient to loop through adding all your row data to a list, and then calling the toDataSet function with your list of rows.