# Getting a value from a table's self.data

**URL:** <https://forum.inductiveautomation.com/t/getting-a-value-from-a-tables-self-data/57904>\
**Category:** Ignition\
**Tags:** scripting, database, ignition79\
**Created:** [March 31, 2022, 10:39pm UTC](https://forum.inductiveautomation.com/t/getting-a-value-from-a-tables-self-data/57904 "2022-03-31T22:39:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SOPerator](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@SOPerator](https://forum.inductiveautomation.com/u/SOPerator)\
**Post date:** [March 31, 2022, 10:39pm UTC](https://forum.inductiveautomation.com/t/getting-a-value-from-a-tables-self-data/57904/1 "2022-03-31T22:39:52Z")

</div>

I’m currently trying to accomplish two things in a regular table:

1. Using propertyChange scripting, I want to make it so that when a selected row’s value is in an array of items I want to exclude, a messageBox pops up to tell the user that item is deprecated, as well as make the selected row value equal to -1
2. Using getForegroundAt under extension functions, I’d like to be able to return a grey for values that are in this same array.

This is what I have for each function

1. propertyChange

````auto

if event.propertyName=='selectedRow':
		currValue = self.data.getValueAt(event.source.selectedRow,event.source.selectedColumn)
		if currValue in deprecatedValues: #deprecatedValues is an array of values
			system.gui.messageBox("Sorry, this value is no longer used. Please select a new one")
			event.source.selectedRow =- 1 ```

2.getForegroundAt
```	currValue = self.data.getValueAt(row,col)
	if currValue in deprecatedValues:
		return 'grey'
	else:
	return defaultColor

````

The error I’m running into is “NameError: name ‘self’ is not defined”  
This refers to my lines of

```auto
		currValue = self.data.getValueAt(event.source.selectedRow,event.source.selectedColumn)

```

Is this not how I should access these values?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 31, 2022, 11:40pm UTC](https://forum.inductiveautomation.com/t/getting-a-value-from-a-tables-self-data/57904/2 "2022-03-31T23:40:20Z")

</div>

The propertyChange does not have a variable `self`

Instead you’ll need to get a reference to the table component, something like:

```auto
data = event.source.data

```

or if the property change is not on the table:

```auto
data = event.source.parent.getComponent(“Table”).data

```

The easiest way is to use the property browser to get a reference to the property you want

---

<div class="post-metadata">

**Author:** ![jacque\_trahan](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jacque_trahan/32/58886_2.png) [@jacque\_trahan](https://forum.inductiveautomation.com/u/jacque_trahan)\
**Post date:** [May 3, 2023, 3:27pm UTC](https://forum.inductiveautomation.com/t/getting-a-value-from-a-tables-self-data/57904/3 "2023-05-03T15:27:55Z")

</div>

I went a little bit further to get my value. I could not find much information except these to links on different way to use **onPopupTrigger()**

[Support page](https://support.inductiveautomation.com/hc/en-us/articles/360047599031-Working-with-Power-Table-Extension-Functions#onPopupTrigger)  
and  
[Documentation](https://docs.inductiveautomation.com/display/DOC79/Component+Events)

what worked for me after many many trial and errors:

```auto
ValueNeeded= self.parent.getComponent('Power Table').data.getValueAt(rowIndex, "SQLdataBaseColName")

```

**Edit: how I found this out**

1. Went to the power table component [docs](https://docs.inductiveautomation.com/display/DOC81/Vision+-+Power+Table) to see what properties I could use on it

2. saw I could use .data and needed to find what methods go with that and I went [here](https://docs.inductiveautomation.com/display/DOC80/Datasets) to find that

3. just trial and error or trying different ways to grab data from a sql database. Failed at getting anything that wasn’t in the table itself. Remedy, add all columns needed and just hide the one we don’t need
