[Vision] Creating a dataset of combined data types to export as CSV

Hi everyone,

I have many "Number Input Text Field" components grouped together with bindings to a custom property of type Dataset. I need to export this dataset as a csv file for Canary's Historian csv collector to consume.

The csv collector expects the first row of the file to be the tag names of type String and the second row the Engineering Units of type String as well.

I have a script that deconstructs the dataset into rows and appends the engineering units row (as a list) just below the header, but the problem is when I call system.dataset.toDataSet(List[Strings], List[AnyType]).

The conversion fails because the second row contains values of type String while the columns I defined are types double and boolean.

Here's a simplified version of what my csv export should look like:

time log_1 log_2 log_3 check_1 log_5
(time) (double) (double) (double) (bool) (double)
10:57 AM 30.5 56 67 1 45
11:57 AM 23.5 12 67 0 78
13:57 AM 12.5 67 6 1 23
14:57 AM 124 213 67 0 90
16:57 AM 78.7 43 34 1 12

Is there any work around or a better way of doing this?

Anything helps, thank you all!

You can use the DatasetBuilder class to explicitly set column types before adding rows. But note that Engineering unit strings in an actual row will always require a string-compatible data type for the column.

You will need to construct your own CSV export tool that can inject a data type row after the headers, or possibly use multi-line text in the "header" row.

Yes, I think I'll write a csv export tool.

Thank you for the information!