# Insert selected row to database table

**URL:** <https://forum.inductiveautomation.com/t/insert-selected-row-to-database-table/10274>\
**Category:** Ignition\
**Created:** [July 24, 2015, 6:07pm UTC](https://forum.inductiveautomation.com/t/insert-selected-row-to-database-table/10274 "2015-07-24T18:07:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RyanG](https://avatars.discourse-cdn.com/v4/letter/r/9de053/32.png) [@RyanG](https://forum.inductiveautomation.com/u/RyanG)\
**Post date:** [July 24, 2015, 6:07pm UTC](https://forum.inductiveautomation.com/t/insert-selected-row-to-database-table/10274/1 "2015-07-24T18:07:26Z")

</div>

Hi, I’m working with an Alarm Status Table and I want to be able to hit a button and Insert the selected row of data into a database Table. Where I’m running into trouble is when I try to grab the Selected Alarms data with the following code, data = event.source.parent.getComponent(‘Alarms’).selectedAlarms, all I’m able to grab is, Dataset [1R ? 6C], How can I select the actual data that is stored in this location? I’m pretty new to ignition, sql, and python and have only be using them for the past few weeks so be easy on me.

Thanks!

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [July 24, 2015, 6:15pm UTC](https://forum.inductiveautomation.com/t/insert-selected-row-to-database-table/10274/2 "2015-07-24T18:15:30Z")

</div>

Take the dataset that you get and convert it into a single Python list.

Like this:

```auto
data = event.source.parent.getComponent('Alarms').selectedAlarms
data = list(system.dataset.toPyDataSet(data)[0])
```

Now you have the values of the row as a Python list.

Best,

---

<div class="post-metadata">

**Author:** ![RyanG](https://avatars.discourse-cdn.com/v4/letter/r/9de053/32.png) [@RyanG](https://forum.inductiveautomation.com/u/RyanG)\
**Post date:** [July 24, 2015, 6:30pm UTC](https://forum.inductiveautomation.com/t/insert-selected-row-to-database-table/10274/3 "2015-07-24T18:30:18Z")

</div>

Thanks! That works!
