Populating Text Fields With Query Results

I have a Named Query "SelectData":

Select short , long , part ,
length , location , height , number ,
position01 , position02, position03, position04 , position05 ,
position06 , position07 , position08 , position09 , position10 ,
position11 , position12 , position13 , position14 , position15 ,
position16 , position17 , position18 , position19 , position20 ,
position21 , position22 , position23 , position24 , position25 ,
position26 , position27 , position28 , position29 , position30
from table
where name = :qname

This works fine, I tested it.

Now I have a button and I want to place query results into Text Fields.
Under the button action:

#grab query value
qname = event.source.parent.getComponent('Text Field 3').text

#run query
result = system.db.runNamedQuery("SelectData", {"qname":qname})

#Place Results in Text Fields
event.source.parent.getComponent('Text Field 1').text = result["short"]
event.source.parent.getComponent('Text Field 2').text = result["long"]

I get errors on the placing of the results in text fields.

Your named query is likely returning a dataset - even if there's only one row, you can't access it just by column name like that. You probably want event.source.parent.getComponent('Text Field 1').text = result.getValueAt(0, "short").


OK I tried it. Same error:
TypeError: 'com.inductiveautomation.ignition.common.BasicDataset' object is unsubscriptable

Paste your code, because that error is caused by the code you originally had, not the code I wrote.

The solution I found was to convert the dataset to python dataset.

This worked:
pyData = system.dataset.toPyDataSet(result)
event.source.parent.getComponent('Text Field 1').text = pyData[0][1]
event.source.parent.getComponent('Text Field 4').text = pyData[0][4]