# Pulling Specific Cell Data from a Table

**URL:** <https://forum.inductiveautomation.com/t/pulling-specific-cell-data-from-a-table/79479>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [September 21, 2023, 8:10pm UTC](https://forum.inductiveautomation.com/t/pulling-specific-cell-data-from-a-table/79479 "2023-09-21T20:10:06Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![NP209](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/np209/32/80704_2.png) [@NP209](https://forum.inductiveautomation.com/u/NP209)\
**Post date:** [September 21, 2023, 8:10pm UTC](https://forum.inductiveautomation.com/t/pulling-specific-cell-data-from-a-table/79479/1 "2023-09-21T20:10:06Z")

</div>

Hello, figured out almost everything I needed for my project but can't seem to figure this last bit out. I want to let the user select a row from a table that has 6 columns. From the row selected I want to send the order number over to the main page from the popup window. Here is what I have. I'm not sure what to add to the props.selection.data to just send the order number across. Any ideas anyone?

```auto
def runAction(self, event):
	textValue=self.getSibling("Table").props.selection.data
	payload = {
		"fieldFromPopup": textValue
	}
	
	system.perspective.sendMessage("receiveFromPopup", payload)
	
	system.perspective.closePopup("PopupForm")

```

---

<div class="post-metadata">

**Author:** ![Felipe\_CRM](https://avatars.discourse-cdn.com/v4/letter/f/dfb087/32.png) [@Felipe\_CRM](https://forum.inductiveautomation.com/u/Felipe_CRM)\
**Post date:** [September 21, 2023, 8:15pm UTC](https://forum.inductiveautomation.com/t/pulling-specific-cell-data-from-a-table/79479/2 "2023-09-21T20:15:29Z")

</div>

`props.selection.selectedRow` will give you the selected row number.

EDIT: I think I misunderstood your question, whoops.

EDIT 2: On testing, @Transistor's syntax doesn't quite work if your data is formatted like the example table with the data array; it should be `textValue = self.getSibling("Table").props.selection.data[0].city`

---

<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 21, 2023, 8:16pm UTC](https://forum.inductiveautomation.com/t/pulling-specific-cell-data-from-a-table/79479/3 "2023-09-21T20:16:01Z")

</div>

> [@NP209](#):
>
> `textValue=self.getSibling("Table").props.selection.data`

`textValue = self.getSibling("Table").props.selection.data.0.city`  
should give you the cell value (or whatever).

---

<div class="post-metadata">

**Author:** ![NP209](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/np209/32/80704_2.png) [@NP209](https://forum.inductiveautomation.com/u/NP209)\
**Post date:** [September 21, 2023, 8:29pm UTC](https://forum.inductiveautomation.com/t/pulling-specific-cell-data-from-a-table/79479/4 "2023-09-21T20:29:25Z")

</div>

My table is filled with data from my test SQL database.its showing as a dataset and doesn't have the various arrays like the example table has.

---

<div class="post-metadata">

**Author:** ![Felipe\_CRM](https://avatars.discourse-cdn.com/v4/letter/f/dfb087/32.png) [@Felipe\_CRM](https://forum.inductiveautomation.com/u/Felipe_CRM)\
**Post date:** [September 21, 2023, 8:30pm UTC](https://forum.inductiveautomation.com/t/pulling-specific-cell-data-from-a-table/79479/5 "2023-09-21T20:30:02Z")

</div>

If it's a dataset, you should be able to use `data.getValueAt(0, columnName)`

EDIT: I tested it out and it looks like `selection.data` should still be an array of objects, even if the table source is a dataset. in that case Transistor's solution would apply (with the corrected syntax in my first post).

---

<div class="post-metadata">

**Author:** ![NP209](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/np209/32/80704_2.png) [@NP209](https://forum.inductiveautomation.com/u/NP209)\
**Post date:** [September 21, 2023, 8:43pm UTC](https://forum.inductiveautomation.com/t/pulling-specific-cell-data-from-a-table/79479/6 "2023-09-21T20:43:38Z")

</div>

sorry im not following entirely.

so it would be a combination of the two?

```auto
textValue = self.getSibling("Table").props.selection.data(0,columnName)

```

---

<div class="post-metadata">

**Author:** ![Felipe\_CRM](https://avatars.discourse-cdn.com/v4/letter/f/dfb087/32.png) [@Felipe\_CRM](https://forum.inductiveautomation.com/u/Felipe_CRM)\
**Post date:** [September 21, 2023, 8:44pm UTC](https://forum.inductiveautomation.com/t/pulling-specific-cell-data-from-a-table/79479/7 "2023-09-21T20:44:38Z")

</div>

No, `self.getSibling("Table").props.selection.data[0].columnName` would be correct - I just tested it for myself. Sorry for the confusion.

I was under the impression that the selected data would also go through as a dataset, but that isn't the case.

---

<div class="post-metadata">

**Author:** ![NP209](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/np209/32/80704_2.png) [@NP209](https://forum.inductiveautomation.com/u/NP209)\
**Post date:** [September 21, 2023, 8:46pm UTC](https://forum.inductiveautomation.com/t/pulling-specific-cell-data-from-a-table/79479/8 "2023-09-21T20:46:39Z")

</div>

![2023-09-21_13-34-14](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/6/6674b80a86a2049abfda72319a8b805107777bb6.png)

This is what i'm putting in but its getting hung up

---

<div class="post-metadata">

**Author:** ![Felipe\_CRM](https://avatars.discourse-cdn.com/v4/letter/f/dfb087/32.png) [@Felipe\_CRM](https://forum.inductiveautomation.com/u/Felipe_CRM)\
**Post date:** [September 21, 2023, 8:48pm UTC](https://forum.inductiveautomation.com/t/pulling-specific-cell-data-from-a-table/79479/9 "2023-09-21T20:48:19Z")

</div>

Can you open up the table `props.selection.data` for us? I'm guessing it's using a different name for that column internally.

---

<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 21, 2023, 8:48pm UTC](https://forum.inductiveautomation.com/t/pulling-specific-cell-data-from-a-table/79479/10 "2023-09-21T20:48:28Z")

</div>

You haven't really got a column named 'Order#' have you? Python will take the # as the start of a comment (as indicated by the editor changing color to green).

---

<div class="post-metadata">

**Author:** ![NP209](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/np209/32/80704_2.png) [@NP209](https://forum.inductiveautomation.com/u/NP209)\
**Post date:** [September 21, 2023, 8:49pm UTC](https://forum.inductiveautomation.com/t/pulling-specific-cell-data-from-a-table/79479/11 "2023-09-21T20:49:04Z")

</div>

yeah i think it is XD let me try and change the name

---

<div class="post-metadata">

**Author:** ![Felipe\_CRM](https://avatars.discourse-cdn.com/v4/letter/f/dfb087/32.png) [@Felipe\_CRM](https://forum.inductiveautomation.com/u/Felipe_CRM)\
**Post date:** [September 21, 2023, 8:51pm UTC](https://forum.inductiveautomation.com/t/pulling-specific-cell-data-from-a-table/79479/12 "2023-09-21T20:51:42Z")

</div>

~~You shouldn't need to change the name, Perspective's almost certainly sanitized it somehow internally. You just need to find what the sanitized version is so you can use it in your code.~~

EDIT: looking at later screenshots, it looks like Perspective sanitizes nothing and happily keeps the # at the end of the column name, that's interesting and good to know.

I mean if that's your actual SQL column name maybe that's not the best name but that's neither here nor there 😁

---

<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 21, 2023, 8:53pm UTC](https://forum.inductiveautomation.com/t/pulling-specific-cell-data-from-a-table/79479/13 "2023-09-21T20:53:37Z")

</div>

There's another way to reference the column name but I can't remember the exact syntax. Something like,  
`self.getSibling("Table").props.selection.data[0]['Order#']`  
Anyone?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [September 21, 2023, 8:53pm UTC](https://forum.inductiveautomation.com/t/pulling-specific-cell-data-from-a-table/79479/14 "2023-09-21T20:53:53Z")

</div>

> [@Transistor](#):
>
> Anyone?

Exactly what you have. Fixing the column names in the underlying data is preferred though.

---

<div class="post-metadata">

**Author:** ![NP209](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/np209/32/80704_2.png) [@NP209](https://forum.inductiveautomation.com/u/NP209)\
**Post date:** [September 21, 2023, 8:58pm UTC](https://forum.inductiveautomation.com/t/pulling-specific-cell-data-from-a-table/79479/15 "2023-09-21T20:58:07Z")

</div>

![2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/3/934459f0d79936f7e2acb02306b6446264d0cb15.png)  
Okay I changed the name of the column in my SQL database so the column name wouldn't have the # in it. Its still getting hung up though.

---

<div class="post-metadata">

**Author:** ![Felipe\_CRM](https://avatars.discourse-cdn.com/v4/letter/f/dfb087/32.png) [@Felipe\_CRM](https://forum.inductiveautomation.com/u/Felipe_CRM)\
**Post date:** [September 21, 2023, 9:00pm UTC](https://forum.inductiveautomation.com/t/pulling-specific-cell-data-from-a-table/79479/16 "2023-09-21T21:00:13Z")

</div>

Could you go ahead and select a row in your table and then show us what that data structure looks like here?

That said, `self.getSibling("Table").props.selection.data[0]['OrderNumber']` should work at this point, as mentioned above.

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/4/c4682a3004301ee76fe76283d6010960bdf0da80.png)

---

<div class="post-metadata">

**Author:** ![NP209](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/np209/32/80704_2.png) [@NP209](https://forum.inductiveautomation.com/u/NP209)\
**Post date:** [September 21, 2023, 9:04pm UTC](https://forum.inductiveautomation.com/t/pulling-specific-cell-data-from-a-table/79479/17 "2023-09-21T21:04:31Z")

</div>

![3](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/f/0f72bd8f569652a3dff5d5e5626bfbb1a29223d2.png)  
here you go

---

<div class="post-metadata">

**Author:** ![Felipe\_CRM](https://avatars.discourse-cdn.com/v4/letter/f/dfb087/32.png) [@Felipe\_CRM](https://forum.inductiveautomation.com/u/Felipe_CRM)\
**Post date:** [September 21, 2023, 9:05pm UTC](https://forum.inductiveautomation.com/t/pulling-specific-cell-data-from-a-table/79479/18 "2023-09-21T21:05:19Z")

</div>

I see you're pulling from `props.data` instead of `props.selection.data`. That would do it

---

<div class="post-metadata">

**Author:** ![NP209](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/np209/32/80704_2.png) [@NP209](https://forum.inductiveautomation.com/u/NP209)\
**Post date:** [September 21, 2023, 9:06pm UTC](https://forum.inductiveautomation.com/t/pulling-specific-cell-data-from-a-table/79479/19 "2023-09-21T21:06:25Z")

</div>

you got it, thanks so much!!!!
