# How can table cell data entry be restricted to numeric only?

**URL:** <https://forum.inductiveautomation.com/t/how-can-table-cell-data-entry-be-restricted-to-numeric-only/37972>\
**Category:** General Discussion\
**Tags:** vision\
**Created:** [August 21, 2020, 10:38am UTC](https://forum.inductiveautomation.com/t/how-can-table-cell-data-entry-be-restricted-to-numeric-only/37972 "2020-08-21T10:38:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [August 21, 2020, 10:38am UTC](https://forum.inductiveautomation.com/t/how-can-table-cell-data-entry-be-restricted-to-numeric-only/37972/1 "2020-08-21T10:38:37Z")

</div>

How can I restrict table cell data entry to numeric value (and backspace / delete / . / + / -) only? There is no customizer available. (Ignition 8.0.)

Do I have to script in the keyPressed or keyTyped event? It seems like something that should be built-in.

---

<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:** [August 21, 2020, 11:45am UTC](https://forum.inductiveautomation.com/t/how-can-table-cell-data-entry-be-restricted-to-numeric-only/37972/2 "2020-08-21T11:45:52Z")

</div>

Why is no customizer available?

Aside from that, in tricky cases, you can generate custom cell editors for the Power Table. These posts cover many cases:

[http://forum.inductiveautomation.com/search?q=TableCellEditor](http://forum.inductiveautomation.com/search?q=TableCellEditor)

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [August 21, 2020, 1:43pm UTC](https://forum.inductiveautomation.com/t/how-can-table-cell-data-entry-be-restricted-to-numeric-only/37972/3 "2020-08-21T13:43:37Z")

</div>

Sorry, Paul. I worded that badly.

The table customizer is available but has no options for “numeric only” or keypress filtering.

I had already had a good look through the forum and web search but didn’t find an answer.

Thank you.

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [August 21, 2020, 2:53pm UTC](https://forum.inductiveautomation.com/t/how-can-table-cell-data-entry-be-restricted-to-numeric-only/37972/4 "2020-08-21T14:53:59Z")

</div>

Psst! _Phil not Paul_

Perhaps check out RegEx

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [September 23, 2020, 4:12pm UTC](https://forum.inductiveautomation.com/t/how-can-table-cell-data-entry-be-restricted-to-numeric-only/37972/5 "2020-09-23T16:12:08Z")

</div>

Sorry, Phil, for the misnomer. (I remembered the first and last letters only.)

I solved the problem as follows. Note that I only want column 2 to be editable.

- On the Power Table scripting editor enable the _isCellEditable_ extension function. Add in:

```auto
	if colIndex == 2: 
		return True
	else:
		return False

```

- Enable the _onCellEdited_ extension function and add in something like this:

```auto
	errMsg = ''

	try:
		# Test if newValue is a valid float.
		newValue = float(newValue)
	except ValueError:
		errMsg = 'Invalid number value entered: ' + str(newValue)  

	if errMsg <> '':
		system.gui.messageBox(errMsg, 'Sorry')
        # The oldValue will automatically reappear.
	else:
		newData = system.dataset.setValue(self.data, rowIndex, colIndex, str(newValue))
		self.data = newData
		# Update the CSV file.	

```

Now to update the CSV file!
