Deleting lines in a dataset connected to a powertable

To be precise, I have a Powertable that is connected to a dataset. This dataset takes the data from a csv file. The csv file contains empty lines or wrong data(that is, it has data that does not interest me). I need to remove these “empty lines” when they are displayed in the powertable. How could I do this? Thanks

system.dataset.deleteRows maybe?

How are you going from CSV to dataset?

Hi, here is my code:
import csv
import os

filePath = “C:\Sup\ exe_v2.csv”

if os.path.exists(filePath):

#system.gui.messageBox("if file exist")

csvFile = open(filePath, 'r')
reader=csv.reader(csvFile, delimiter=';')
header = reader. next ()
dataset = system.dataset.toDataSet(header , list (reader))


data ="[default]dataset").value

smalldata=system.dataset.filterColumns(data, ["C","CM","CMPT"])
event.source.parent.getComponent('Power Table').data = smalldata



This works for me to remove even numbers from the power table test data. There is a high likelihood that this is not the best way. Hopefully someone will come along with a more elegant method than looping through every row, but it should work as long as your table isn’t gigantic.

# You don't need the first two lines. They are just for me to get a dataset.
pt = event.source.parent.getComponent('Power Table')
data =

# You'll need to write your own filter function. This one filters out even numbers
def filterFunc(i):
	if i % 2 == 0:
		return 1
	return 0

# You'll probably want to change the column index you're sending to filterFunc
rowsToRemove = []
for row in range(data.rowCount):
	if filterFunc(data.getValueAt(row,0)):

filteredDataset = system.dataset.deleteRows(data,rowsToRemove)

You also don’t need the dataset as a tag for anything in this script. You may be using it somewhere else, but if you’re not, you don’t need the system.tag.write call. You for sure don’t need the call. Just continue to pass use the variable you’ve called dataset. and system.tag.write are also (I think, someone will correct me if I’m wrong) depreciated. For new scripts opt for system.tag.readBlocking, system.tag.readAsync, system.tag.writeBlocking, or system.tag.writeAsync depending on your need.