List to dataset

I found this topic elsewhere in Ignition problems but the topic was locked.
Since I’m looking for the same result, I’ll repost this issue.

[code]dataTable = event.source.parent.getComponent(‘Table’).data
pyDataIn = system.dataset.toPyDataSet(dataTable)

headers = [“Shift Name”]
data = []

for row in pyDataIn:
shiftName = row[“Shiftname”]
selected = row[“Select”]
if selected:
data.append([shiftName])

This error only appears in preview mode in the designer.
if len(data):
newDs = system.dataset.toDataSet(headers, data)
event.source.parent.getComponent(‘Table’).Select = newDs[/code]

This is supposed to take a dataset from a table component and loop through the rows checking to see which rows have the selected value True and then create another dataset of the number of “selected” rows.

The code seems to work, BUT I am getting an error anyways about this

Traceback (most recent call last):

File “event:propertyChange”, line 4, in

TypeError: toPyDataSet(): 1st arg can’t be coerced to com.inductiveautomation.ignition.common.Dataset

Ignition v7.6.6 (b2014040112)
Java: Sun Microsystems Inc. 1.6.0_45

Show the full traceback – it should identify what the dataTable was at that point. Are you sure it wasn’t null?

I think I found the issue (was unrelated)
the code works fine.