# A quick way to clear the contents of an unbound table

**URL:** <https://forum.inductiveautomation.com/t/a-quick-way-to-clear-the-contents-of-an-unbound-table/10949>\
**Category:** Ignition\
**Created:** [December 21, 2015, 10:10pm UTC](https://forum.inductiveautomation.com/t/a-quick-way-to-clear-the-contents-of-an-unbound-table/10949 "2015-12-21T22:10:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cbanzet](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cbanzet/32/6207_2.png) [@cbanzet](https://forum.inductiveautomation.com/u/cbanzet)\
**Post date:** [December 21, 2015, 10:10pm UTC](https://forum.inductiveautomation.com/t/a-quick-way-to-clear-the-contents-of-an-unbound-table/10949/1 "2015-12-21T22:10:00Z")

</div>

I'm using an unbound table to accumulate a user's selections from a super long drop down list - that way the user can see all of the selections easily before he finalizes. When he clicks "OK" and I'm finished with the data, I want to clear the table to start over. I figured it would be easiest just to replace the tables entire dataset. I can't quite get it to work with scripting. Something's breaking down between the Pydataset and the dataset.

When I try this code:

`tbl = event.source.parent.getComponent('tblBenefitsList')
header = ['id','Benefit']
data = system.dataset.toDataSet(header)
tbl.data = data
`

I get this error:

> [@](#):
>
> TypeError: toDataSet(): 1st arg can't be coerced to com.inductiveautomation.ignition.common.script.builtin.DatasetUtilities$PyDataSet

And when I try this code:

`tbl = event.source.parent.getComponent('tblBenefitsList')
header = ['id','Benefit']
row = [None, None]
data = system.dataset.toDataSet(header,row)
tbl.data = data`

I get this error:

> [@](#):
>
> java.lang.ClassCastException: java.lang.ClassCastException: org.python.core.PyNone cannot be cast to org.python.core.PySequence

I feel I'm getting close using this approach, but maybe there's a better way entirely.

---

<div class="post-metadata">

**Author:** ![cbanzet](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cbanzet/32/6207_2.png) [@cbanzet](https://forum.inductiveautomation.com/u/cbanzet)\
**Post date:** [December 21, 2015, 10:13pm UTC](https://forum.inductiveautomation.com/t/a-quick-way-to-clear-the-contents-of-an-unbound-table/10949/2 "2015-12-21T22:13:36Z")

</div>

Disregard. Literally 15 seconds after my post, I tried this code and it worked.

`tbl = event.source.parent.getComponent('tblBenefitsList')
header = ['id','Benefit']
row = []
data = system.dataset.toDataSet(header,row)
tbl.data = data
`

I’ll leave the post up in case it benefits someone else or if someone wants to show me a better way.
