# Return data from Table in Perspective from user click

**URL:** <https://forum.inductiveautomation.com/t/return-data-from-table-in-perspective-from-user-click/27129>\
**Category:** Ignition\
**Created:** [August 2, 2019, 9:32pm UTC](https://forum.inductiveautomation.com/t/return-data-from-table-in-perspective-from-user-click/27129 "2019-08-02T21:32:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![David.Bell](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@David.Bell](https://forum.inductiveautomation.com/u/David.Bell)\
**Post date:** [August 2, 2019, 9:32pm UTC](https://forum.inductiveautomation.com/t/return-data-from-table-in-perspective-from-user-click/27129/1 "2019-08-02T21:32:28Z")

</div>

Hello,  
I am trying to collect the data from a row that the user clicks on in Perspective (Ignition v 8.0.2). When a user clicks on a row of the table, I want to be able to use the values from each column in an SQL query. For example, City= “San Diego”

Thanks!

David

![DatafromTable_Perspective](https://us1.discourse-cdn.com/inductiveautomation/original/2X/9/936c5b84caeb46130b0c0054efa669769e7902d9.jpeg)

---

<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:** [August 2, 2019, 10:10pm UTC](https://forum.inductiveautomation.com/t/return-data-from-table-in-perspective-from-user-click/27129/2 "2019-08-02T22:10:49Z")

</div>

There is some ambiguity in your question.

> [@David.Bell](#):
>
> When a user clicks on a row of the table, I want to be able to use the values from each column in an SQL query.

Do you mean you'll be doing this EVERY TIME a user clicks, or you will possibly be doing it only occasionally?

**If you'll be running a query EVERY TIME:**  
use the `onRowClick()` [component function](https://docs.inductiveautomation.com/display/DOC80/Perspective+-+Table#expander-control-241248469). You'll receive an object like this by referencing `event.value`:  
`{"city":"Prague","country":"Czech Republic","population":1241664}`

**If you'll only be running the query occasionally:**  
You COULD do the same thing as was just discussed and then save the object to some variable and read as-needed, or you could fall back onto `Table.props.selection.data`, which stores an array of the selected rows and their information. Instead of the previously discussed object, you'll receive an array of selected row objects with the same structure, so clicking a row in a table which only allows for single selection would return `[{"city":"Prague","country":"Czech Republic","population":1241664}]`

---

<div class="post-metadata">

**Author:** ![David.Bell](https://avatars.discourse-cdn.com/v4/letter/d/34f0e0/32.png) [@David.Bell](https://forum.inductiveautomation.com/u/David.Bell)\
**Post date:** [August 3, 2019, 11:50am UTC](https://forum.inductiveautomation.com/t/return-data-from-table-in-perspective-from-user-click/27129/3 "2019-08-03T11:50:33Z")

</div>

> [@cmallonee](#):
>
> `Table.props.selection.data`

Thank you very much! The table.props.selection.data was exactly what I needed!
