# system.dataset.addColumn bug?

**URL:** <https://forum.inductiveautomation.com/t/system-dataset-addcolumn-bug/17558>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [March 30, 2018, 4:51pm UTC](https://forum.inductiveautomation.com/t/system-dataset-addcolumn-bug/17558 "2018-03-30T16:51:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicholas](https://avatars.discourse-cdn.com/v4/letter/n/4da419/32.png) [@nicholas](https://forum.inductiveautomation.com/u/nicholas)\
**Post date:** [March 30, 2018, 4:51pm UTC](https://forum.inductiveautomation.com/t/system-dataset-addcolumn-bug/17558/1 "2018-03-30T16:51:09Z")

</div>

Hello

I am running Ignition 7.9.6 and trying to add a column to a dataset with some _None_ values, with unexpected results. See the code snippet below.

```python
ds = system.dataset.toDataSet(['Id', 'Name'], 
	[[1, 'Nick'], [2, 'Joe'], [3, 'Larry']])
newColumn = [None, 'Shmoe', None]
ds = system.dataset.addColumn(ds, 
	newColumn,
	'LastName',
	str
	)

for r in range(ds.rowCount):
	print '\t'.join(str(ds.getValueAt(r, c))\
		for c in range(ds.columnCount))

# Expected result
#1	Nick	None
#2	Joe	Shmoe
#3	Larry	None

# Output
#1	Nick	None
#2	Joe	Shmoe
#3	Larry	Shmoe

```

Am I doing something wrong or is this a bug?

---

<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:** [March 30, 2018, 5:26pm UTC](https://forum.inductiveautomation.com/t/system-dataset-addcolumn-bug/17558/2 "2018-03-30T17:26:06Z")

</div>

Known bug. See [this thread](http://forum.inductiveautomation.com/t/bug-with-addcolumn-and-none-values/17116).

---

<div class="post-metadata">

**Author:** ![nicholas](https://avatars.discourse-cdn.com/v4/letter/n/4da419/32.png) [@nicholas](https://forum.inductiveautomation.com/u/nicholas)\
**Post date:** [March 30, 2018, 5:39pm UTC](https://forum.inductiveautomation.com/t/system-dataset-addcolumn-bug/17558/3 "2018-03-30T17:39:09Z")

</div>

Alright thanks. If anyone else runs into this, you can workaround it by creating a new column with only _None_, then iterating through it and setting values.

```python
# ds is a dataset from somewhere
colIndex = ds.columnCount
ds = system.dataset.addColumn(ds, 
		[None]*ds.rowCount,
		'Col Name',
		str
		)
indexes = [2, 3]
values = ['x', 'y']
for rowIndex, value in zip(indexes, values):
	ds = system.dataset.setValue(ds, rowIndex, colIndex, value )

```

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [March 30, 2018, 7:51pm UTC](https://forum.inductiveautomation.com/t/system-dataset-addcolumn-bug/17558/4 "2018-03-30T19:51:38Z")

</div>

It’s been fixed in 7.9.8. 😀
