# PyTypes and system.dataset.addColumn()

**URL:** <https://forum.inductiveautomation.com/t/pytypes-and-system-dataset-addcolumn/11279>\
**Category:** Ignition\
**Created:** [February 27, 2016, 2:39am UTC](https://forum.inductiveautomation.com/t/pytypes-and-system-dataset-addcolumn/11279 "2016-02-27T02:39:04Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Caleb\_Bohon](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/caleb_bohon/32/3293_2.png) [@Caleb\_Bohon](https://forum.inductiveautomation.com/u/Caleb_Bohon)\
**Post date:** [February 27, 2016, 2:39am UTC](https://forum.inductiveautomation.com/t/pytypes-and-system-dataset-addcolumn/11279/1 "2016-02-27T02:39:04Z")

</div>

Hi,

I’m trying to use system.dataset.addColumn().

The last argument is giving me trouble. The user manual says [quote] PyType colType - The type of the of the column. The type can be the Python equivalent of String, Long, Double, Short, Integer, Float, Boolean, null, or java.util.Date if they exist. [/quote]

I’m pretty sure I can figure out the PyTypes that relate to most of the native Python types: str, long, double, short, int, float, bool. … but I can’t figure out the date one.

Anyone know?

---

<div class="post-metadata">

**Author:** ![adamaustin](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adamaustin](https://forum.inductiveautomation.com/u/adamaustin)\
**Post date:** [March 21, 2016, 8:46pm UTC](https://forum.inductiveautomation.com/t/pytypes-and-system-dataset-addcolumn/11279/2 "2016-03-21T20:46:21Z")

</div>

You could use the [[color=#FF00FF]type[/color]](http://www.diveintopython.net/power_of_introspection/built_in_functions.html#d0e8510) python function to get the date type when adding a column:

`
tbl = event.source.parent.getComponent("Table")
now = system.tag.read("[System]Client/System/CurrentDateTime").value
col = []
for i in range(tbl.data.getRowCount()):
[ul]col.append(now)[/ul]
tbl.data = system.dataset.addColumn(tbl.data,col,“DateTime”,[b][color=#FF00FF]type[/color]/b)
`

---

<div class="post-metadata">

**Author:** ![hachjessed](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@hachjessed](https://forum.inductiveautomation.com/u/hachjessed)\
**Post date:** [November 30, 2020, 4:33pm UTC](https://forum.inductiveautomation.com/t/pytypes-and-system-dataset-addcolumn/11279/3 "2020-11-30T16:33:54Z")

</div>

Is it possible to append a date or dateTime type column with system.dataset.addColumn()?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [November 30, 2020, 5:01pm UTC](https://forum.inductiveautomation.com/t/pytypes-and-system-dataset-addcolumn/11279/4 "2020-11-30T17:01:18Z")

</div>

Yes. Use java.util.Date for the type.

---

<div class="post-metadata">

**Author:** ![hachjessed](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@hachjessed](https://forum.inductiveautomation.com/u/hachjessed)\
**Post date:** [November 30, 2020, 5:13pm UTC](https://forum.inductiveautomation.com/t/pytypes-and-system-dataset-addcolumn/11279/5 "2020-11-30T17:13:43Z")

</div>

So simple…forgot to import the library. Thank you Jordan!

---

<div class="post-metadata">

**Author:** ![hachjessed](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@hachjessed](https://forum.inductiveautomation.com/u/hachjessed)\
**Post date:** [January 5, 2021, 12:58pm UTC](https://forum.inductiveautomation.com/t/pytypes-and-system-dataset-addcolumn/11279/6 "2021-01-05T12:58:34Z")

</div>

Another column add question - is it possible to add a Color type column to a dataset?  
I have attempted to use something like below, but have not been successful.

```auto
newData = system.dataset.addColumn(data,colorData,'colorCode',java.awt.Color)

```

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [January 5, 2021, 2:11pm UTC](https://forum.inductiveautomation.com/t/pytypes-and-system-dataset-addcolumn/11279/7 "2021-01-05T14:11:57Z")

</div>

Per the documentation

> [@](#):
>
> PyType colType - The type of the of the column. The type can be the Python equivalent of String, Long, Double, Short, Integer, Float, Boolean, null, or java.util.Date if they exist.

If I try this I get an error saying that java.awt.color can not be coerced into a PyType.

---

<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:** [January 5, 2021, 11:15pm UTC](https://forum.inductiveautomation.com/t/pytypes-and-system-dataset-addcolumn/11279/8 "2021-01-05T23:15:44Z")

</div>

You can use the [DatasetBuilder](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.0/com/inductiveautomation/ignition/common/util/DatasetBuilder.html) utility class.
