# \[SOLVED\] Is there a way to convert a dataset column type?

**URL:** <https://forum.inductiveautomation.com/t/solved-is-there-a-way-to-convert-a-dataset-column-type/49971>\
**Category:** Ignition\
**Tags:** ignition80, vision, scripting\
**Created:** [August 16, 2021, 4:55pm UTC](https://forum.inductiveautomation.com/t/solved-is-there-a-way-to-convert-a-dataset-column-type/49971 "2021-08-16T16:55:21Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [August 16, 2021, 6:01pm UTC](https://forum.inductiveautomation.com/t/solved-is-there-a-way-to-convert-a-dataset-column-type/49971/2 "2021-08-16T18:01:36Z")

</div>

Used DataSetBuilder to create a dataset with the right column types.

> [@Vision: Convert dataset column type](https://forum.inductiveautomation.com/t/vision-convert-dataset-column-type/26341/2):
>
> Use Ignition’s [DatasetBuilder](http://files.inductiveautomation.com/sdk/javadoc/ignition79/795/com/inductiveautomation/ignition/common/util/DatasetBuilder.html). Something like this: from com.inductiveautomation.ignition.common.util import DatasetBuilder from java.lang import Integer, String, Object from java.awt import Color def forceTypes(sqlDS): builder = DatasetBuilder.newBuilder() builder.colNames(sqlDS.columnNames) originalTypes = list(sqlDS.columnTypes) i = #some column index for a color originalTypes[i] = Color builder.colTypes(originalTypes) for r in range(sqlDS.rowCount): bui…

Then copy the rows from your dataset with the wrong types into the dataset with the correct column types.

Or it might be as easy to manipulate the CSV to specify the correct types before turning it into a dataset:

> [@Convert columntype in table to integer](https://forum.inductiveautomation.com/t/convert-columntype-in-table-to-integer/9103/5):
>
> Use system.dataset.fromCSV to specify data types and column headers for your blank dataset like this: blankDataset = """#NAMES Header1, Header2, #TYPES d,I #ROWS,0""" See [Ignition Manual](https://docs.inductiveautomation.com:8443/display/DOC79/system.dataset.fromCSV) for data types, etc.

---

_[View the full topic](https://forum.inductiveautomation.com/t/solved-is-there-a-way-to-convert-a-dataset-column-type/49971)._
