One of many options:
def transform(self, value, quality, timestamp):
in_range_values = 0
out_of_range_indices = []
colCount = value.getColumnCount()
for row in range(value.getRowCount()):
if 16 < value.getValueAt(row,1) < 27:
in_range_values += 1
else:
out_of_range_indices.append(row)
rowsRemoved = system.dataset.deleteRows(value, out_of_range_indices)
newDataset = system.dataset.addColumn(rowsRemoved, colCount, in_range_values, "results", bool)
return newDataset
Ignition Extensions, my free convenience function module, also adds a system.dataset.filter
function, so you could rewrite your code as:
def transform(self, value, quality, timestamp):
in_range_values = []
colCount = value.getColumnCount()
for row in range(value.getRowCount()):
in_range_values.append(16 < value.getValueAt(row,1) < 27)
addedColumn = system.dataset.addColumn(rowsRemoved, colCount, in_range_values, "results", bool)
newDataset = system.dataset.filter(addedColumn, lambda **columns: columns["results"])
return newDataset