# Compact Table Scripting and Add IF statement to columnData.append

**URL:** <https://forum.inductiveautomation.com/t/compact-table-scripting-and-add-if-statement-to-columndata-append/18358>\
**Category:** Ignition\
**Created:** [June 8, 2018, 2:32pm UTC](https://forum.inductiveautomation.com/t/compact-table-scripting-and-add-if-statement-to-columndata-append/18358 "2018-06-08T14:32:00Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [June 8, 2018, 3:12pm UTC](https://forum.inductiveautomation.com/t/compact-table-scripting-and-add-if-statement-to-columndata-append/18358/7 "2018-06-08T15:12:18Z")

</div>

Looks much nicer than my rep rep repetitiveness ha ha. I got this code to work and initialize all Booleans to 0.  
Your code threw an error…TypeError: can’t put element of type class java.lang.Booleanin column of type class java.lang.Integer

```auto
po = event.source.value
data = system.db.runNamedQuery("BOM/PoDetails",{"po":po})

fields = ['5x5', '4x8', 'RB', 'HW']

for field in fields:
	columnData = []
	for row in range(data.getRowCount()):
		##description = data.getValueAt(row, "Description")## This line Commented out
		columnData.append(0)
	data = system.dataset.addColumn(data, data.getColumnCount(), columnData, field, int)

event.source.parent.getComponent('Table4').data = data
```

---

_[View the full topic](https://forum.inductiveautomation.com/t/compact-table-scripting-and-add-if-statement-to-columndata-append/18358)._
