PyDataset Value Into Table

I have a script running to bring a selected value into a Vision table:

InsertAssist = ("SELECT matAssist FROM usermaterials WHERE materialName = ?")
args2 = [selected_material]
assist = system.db.runPrepQuery(InsertAssist, args2)
if selRow != -1 and selCol != -1:
   newData = system.dataset.setValue(table.data, selRow, selCol2, assist)
   table.data = newData

But, my result is showing:
image

How can I get the value out of this pydataset? The select query is providing the "name" to be asserted into this cell, so I need that actual value pulled by the prepquery.

A scalar prep query will return a value not a pydataset.
system.db.runScalarPrepQuery | Ignition User Manual

For the future, you can get values from pydatasets a few ways:

# for loop
for row in assist:
    someVal = row['columnName']

# or indexing for row zero and column by name
someVal = assist[0]['columnName']
1 Like

Thank you! I was not aware of this difference

1 Like