Perspective table data vs

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 to a parameter. Most of the time, they actually want all of the rows, so I created another button which passes the tables 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 or the dataset from 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 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
# return the results
return newList

Thanks, I did some searching in the manual before posting but didn’t have this pop up.

1 Like

I just found it under the script transform section: