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

**URL:** <https://forum.inductiveautomation.com/t/vision-creating-a-dataset-of-combined-data-types-to-export-as-csv/74188>\
**Category:** Ignition\
**Tags:** ignition81, vision, scripting\
**Created:** [May 25, 2023, 6:08pm UTC](https://forum.inductiveautomation.com/t/vision-creating-a-dataset-of-combined-data-types-to-export-as-csv/74188 "2023-05-25T18:08:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fbrinneman](https://avatars.discourse-cdn.com/v4/letter/f/e9a140/32.png) [@fbrinneman](https://forum.inductiveautomation.com/u/fbrinneman)\
**Post date:** [May 25, 2023, 6:08pm UTC](https://forum.inductiveautomation.com/t/vision-creating-a-dataset-of-combined-data-types-to-export-as-csv/74188/1 "2023-05-25T18:08:49Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 25, 2023, 6:17pm UTC](https://forum.inductiveautomation.com/t/vision-creating-a-dataset-of-combined-data-types-to-export-as-csv/74188/2 "2023-05-25T18:17:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![fbrinneman](https://avatars.discourse-cdn.com/v4/letter/f/e9a140/32.png) [@fbrinneman](https://forum.inductiveautomation.com/u/fbrinneman)\
**Post date:** [May 25, 2023, 9:08pm UTC](https://forum.inductiveautomation.com/t/vision-creating-a-dataset-of-combined-data-types-to-export-as-csv/74188/3 "2023-05-25T21:08:23Z")

</div>

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

Thank you for the information!
