# Pull cell data from perspective table

**URL:** <https://forum.inductiveautomation.com/t/pull-cell-data-from-perspective-table/37233>\
**Category:** Ignition\
**Created:** [July 30, 2020, 6:34pm UTC](https://forum.inductiveautomation.com/t/pull-cell-data-from-perspective-table/37233 "2020-07-30T18:34:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dholt](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dholt/32/4458_2.png) [@dholt](https://forum.inductiveautomation.com/u/dholt)\
**Post date:** [July 30, 2020, 6:34pm UTC](https://forum.inductiveautomation.com/t/pull-cell-data-from-perspective-table/37233/1 "2020-07-30T18:34:29Z")

</div>

Hello, I have a JSON formatted table that I'm trying to read a value from a specific column, on the selected row and write that value back to a tag that is failing.

Current event script:

```auto
def runAction(self, event):
	
	val=self.props.data[selectedRow]['MPAID'].value
	#self.props.selection.selectedRow
	tag="[default]Perspective/MPAID"
	system.tag.writeBlocking(tag,val)

```

The first column in this table is a column titled "MPAID" that I'm trying to reference in a seperate embedded view, when I click on this table however I get the following error back:

> com.inductiveautomation.ignition.common.script.JythonExecException  
> Traceback (most recent call last):  
> File "function:runAction", line 2, in runAction  
> NameError: global name 'selectedRow' is not defined  
> caused by org.python.core.PyException  
> Traceback (most recent call last):  
> File "function:runAction", line 2, in runAction  
> NameError: global name 'selectedRow' is not defined

I'm assuming that "selectedRow" is not the right usage here, but I'm not sure what else to use here, any advice? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![code\_skin](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@code\_skin](https://forum.inductiveautomation.com/u/code_skin)\
**Post date:** [July 30, 2020, 7:14pm UTC](https://forum.inductiveautomation.com/t/pull-cell-data-from-perspective-table/37233/2 "2020-07-30T19:14:03Z")

</div>

> [@dholt](#):
>
> val=self.props.data[selectedRow]['MPAID'].value

Try replacing the above line with

```auto
val=self.props.data[self.props.selection.selectedRow].MPAID

```

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [July 30, 2020, 9:54pm UTC](https://forum.inductiveautomation.com/t/pull-cell-data-from-perspective-table/37233/3 "2020-07-30T21:54:36Z")

</div>

The error is telling you that you’re using a variable `selectedRow` but you haven’t defined the value of that variable. I do believe @code_skin has the right idea, but, as you already have selection data available to you, you could do this (assuming `props.selection.enableRowSelection` and `props.selection.enableColumnSelection` are both enabled):

```auto
val=self.props.selection.data[0]['MPAID']
tag="[default]Perspective/MPAID"
system.tag.writeBlocking(tag,val)

```

---

<div class="post-metadata">

**Author:** ![dholt](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dholt/32/4458_2.png) [@dholt](https://forum.inductiveautomation.com/u/dholt)\
**Post date:** [August 3, 2020, 4:39pm UTC](https://forum.inductiveautomation.com/t/pull-cell-data-from-perspective-table/37233/4 "2020-08-03T16:39:15Z")

</div>

Thank you both @code_skin and @cmallonee Appreciate the help!
