# How to extract the value of the selected row

**URL:** <https://forum.inductiveautomation.com/t/how-to-extract-the-value-of-the-selected-row/8817>\
**Category:** Ignition\
**Created:** [July 30, 2014, 4:02pm UTC](https://forum.inductiveautomation.com/t/how-to-extract-the-value-of-the-selected-row/8817 "2014-07-30T16:02:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Francisco.Mejia](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/francisco.mejia/32/63246_2.png) [@Francisco.Mejia](https://forum.inductiveautomation.com/u/Francisco.Mejia)\
**Post date:** [July 30, 2014, 4:02pm UTC](https://forum.inductiveautomation.com/t/how-to-extract-the-value-of-the-selected-row/8817/1 "2014-07-30T16:02:46Z")

</div>

Hi,  
Suppose you have table in a for with some records and you select a row. How do you get the value stored in the selected row and in a particular column and place that value in a text box ?

Thanks  
Francisco

---

<div class="post-metadata">

**Author:** ![adamaustin](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adamaustin](https://forum.inductiveautomation.com/u/adamaustin)\
**Post date:** [July 30, 2014, 4:21pm UTC](https://forum.inductiveautomation.com/t/how-to-extract-the-value-of-the-selected-row/8817/2 "2014-07-30T16:21:00Z")

</div>

Try this: [Get value of specfic cell in a table?](https://inductiveautomation.com/forum/viewtopic.php?f=70&t=12568)

---

<div class="post-metadata">

**Author:** ![Luke.Stone](https://avatars.discourse-cdn.com/v4/letter/l/5fc32e/32.png) [@Luke.Stone](https://forum.inductiveautomation.com/u/Luke.Stone)\
**Post date:** [July 30, 2014, 4:54pm UTC](https://forum.inductiveautomation.com/t/how-to-extract-the-value-of-the-selected-row/8817/3 "2014-07-30T16:54:32Z")

</div>

See the “Working With Different Datatypes” in the user manual. Specifically -

Accessing data in a DataSet  
DataSets have various properties and functions that you can access through Python.  
• rowCount - returns the number of rows in the dataset  
• columnCount - returns the number of columns in the dataset  
• getColumnName(index) - returns the name of the column at the given index  
• getValueAt(row, column) - returns the value from the dataset at the given location. column can be either an integer or a column name, which is treated case-insensitive.

You will want to grab the dataset out of the table, then call getValueAt(table.selectedRow, table.selectedColumn) on it.

Assume this code was on a button:

table = event.source.parent.getComponent(“Table”)  
textField = event.source.parent.getComponent(“Text Field”)  
data = table.data  
textField.text = data.getValueAt(table.selectedRow,table.selectedColumn)

---

<div class="post-metadata">

**Author:** ![kavya\_shree](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@kavya\_shree](https://forum.inductiveautomation.com/u/kavya_shree)\
**Post date:** [January 9, 2023, 9:49am UTC](https://forum.inductiveautomation.com/t/how-to-extract-the-value-of-the-selected-row/8817/4 "2023-01-09T09:49:10Z")

</div>

how to print the values from the database table by some condition.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/7/3700f8ad5454effe7e396b70c9aecaa14b355c90.png)  
I am able to print headers, how to print values.

Thank you

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [January 9, 2023, 10:50am UTC](https://forum.inductiveautomation.com/t/how-to-extract-the-value-of-the-selected-row/8817/5 "2023-01-09T10:50:34Z")

</div>

I wrote a helper function for that.

> [@View Dataset from script console](https://forum.inductiveautomation.com/t/view-dataset-from-script-console/36704/4):
>
> Sorry, I'm on vacation, but family is napping, so I get to play. Yes, this is how I relax. Don't judge. EDIT: Added option for printing from Perspective. Sorry, not quite ready for prime time. roll_eyes def printDataSet(datasetIn): from itertools import izip import ast if 'PropertyTreeScriptWrapper$ArrayWrapper' in str(type(datasetIn)): headers = datasetIn[0].keys() data = [] for row in datasetIn: data.append([item.value for item in row.values()]) datasetIn = system.dataset…

---

<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:** [January 9, 2023, 8:11pm UTC](https://forum.inductiveautomation.com/t/how-to-extract-the-value-of-the-selected-row/8817/6 "2023-01-09T20:11:43Z")

</div>

Also available in module form, if you want a `system.dataset.print`:

> [@Ignition Extensions - Convenience utilities for advanced users](https://forum.inductiveautomation.com/t/ignition-extensions-convenience-utilities-for-advanced-users/64615):
>
> Introducing a hopefully community-engaged effort to build a useful repository of scripting and other Ignition utilities for everyone to benefit from. Download the latest release from the [Releases](https://github.com/IgnitionModuleDevelopmentCommunity/ignition-extensions/releases) page and take advantage of the following functions: Scripting Functions system.util system.util.getContext(): Context A convenience function to retrieve the local "context" object, useful as an entrypoint to other advanced scripting. system.util.deepCopy(object): Object Converts a given Pyth…
