Insert selected row to database table

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.


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

Like this:

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.


Thanks! That works!