I have a project which has a view with a table. Rows are selected and then a button clicked which opens a popup and passes selection.data to a parameter. Most of the time, they actually want all of the rows, so I created another button which passes the tables props.data to the same parameter. In the popup, I address data in the parameter using scripts like PO = self.view.params.Selection[0].PONumber
I have this project on two gateways. One is v8.1.0 and this works whether I pass in the array from table.selection.data or the dataset from table.props.data. The other is v8.1.15 and I get the error Caused by: org.python.core.PyException: TypeError: ‘com.inductiveautomation.ignition.common.JsonDataset’ object is not iterable
Is there a quick way to convert the dataset to match the selection.data format?
Convert your dataset to an array first, a transform on a custom prop works well for this.
I copied this right out of the manual:
# convert the incoming value data
pyData = system.dataset.toPyDataSet(value)
# get the header names
header = pyData.getColumnNames()
# create a blank list so we can append later
newList = []
# step through the rows
for row in pyData:
# create a new blank dictionary for each row of the data
newDict = {}
# use an index to step through each column of the data
for i in range(len(row)):
# set name/value pairs
newDict[ header[i] ] = row[i]
# append the dictionary to list
newList.append(newDict)
# return the results
return newList