# Allow Blank Cells in Power table

**URL:** <https://forum.inductiveautomation.com/t/allow-blank-cells-in-power-table/18479>\
**Category:** Ignition\
**Created:** [June 15, 2018, 12:42am UTC](https://forum.inductiveautomation.com/t/allow-blank-cells-in-power-table/18479 "2018-06-15T00:42:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stuart](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@Stuart](https://forum.inductiveautomation.com/u/Stuart)\
**Post date:** [June 15, 2018, 12:42am UTC](https://forum.inductiveautomation.com/t/allow-blank-cells-in-power-table/18479/1 "2018-06-15T00:42:52Z")

</div>

Can I allow my power table to accept blank cells?

Right now, if a cell has a value, I can edit that value, but I can not delete it. The table turns the cell red and I can’t move on until entering something in the cell.

Any Ideas?  
My end goal is to have **NULL** stored in the database, and nothing appear in the table cell.

---

<div class="post-metadata">

**Author:** ![Cas](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@Cas](https://forum.inductiveautomation.com/u/Cas)\
**Post date:** [September 5, 2018, 5:40pm UTC](https://forum.inductiveautomation.com/t/allow-blank-cells-in-power-table/18479/2 "2018-09-05T17:40:26Z")

</div>

Stuart,  
I had the exact same issue. The only way I could get around it was to put a “Clear Cell” function in a right-click popup menu.

My code is below, in case it helps you. Note that I only wanted to fire this option on columns 3-8 inclusive. I had to define my database column names because my table headers were different. I am sure there’s a more efficient way, but it does work. All of the java stuff was to select the table cell when I right click (note that my header is two rows high so I am subtracting 32 points from the Y coordinate to account for that).

As with any popup menu, put the code in MousePressed and MouseReleased.

Any questions, let me know.  
Cas

```auto
if event.button != event.BUTTON1:
	def clearCell(event):
		id = event.source.data.getValueAt(event.source.selectedRow,"ID")
		colIndex = event.source.selectedColumn
		if colIndex == 3:
			dbfield = 'WTMin'
		elif colIndex == 4:
			dbfield = 'WTMax'
		elif colIndex == 5:
			dbfield = 'OOR'
		elif colIndex == 6:
			dbfield = 'OD'
		elif colIndex == 7:
			dbfield = 'SmpTime'
		elif colIndex == 8:
			dbfield = 'BoxQC'
		if system.gui.confirm("Are you sure you want to clear this cell?","Clear Cell?"):
			query = "UPDATE ShiftQC SET %s = NULL WHERE id = ?" % (dbfield)
			args = [id]
			system.db.runPrepUpdate(query, args)
			system.db.refresh(event.source,"data")

if event.popupTrigger:
	#These seven lines select the correct row in the table.
	from java.awt import Point
	tbl = event.source
	jTbl = tbl.getTable()
	newY = jTbl.getVisibleRect().y
	newX = jTbl.getVisibleRect().x
	oldPoint = event.getPoint()
	newPoint = Point(oldPoint.x + newX, oldPoint.y-32)
	tbl.setSelectedRow(jTbl.rowAtPoint(newPoint))
	tbl.setSelectedColumn(jTbl.columnAtPoint(newPoint))
	selCol = event.source.selectedColumn
	selRow = event.source.selectedRow

	ID = event.source.data.getValueAt(event.source.selectedRow,"ID")

	if selCol in range(3,9):
		names = ["Clear this Cell"]
		functions = [clearCell]
		menu = system.gui.createPopupMenu(names, functions)
		menu.show(event)

```
