Query binding to piechart

Hello good morning to all,

I am having a problem with displaying the data of my query in the pie chart, I am passing the information I think properly but when I go to the screen I get "data invalid".

Thank you very much for your help, I attach a couple of screenshots that I hope will facilitate the understanding of the problem.
Query
data invalid
script

What do the logs say ? Can you show us the piechart config ?

Also, let's 'fix' that script transform:

for i in range(value.getRowCount()):
    labelList.append(str(system.dataset.toPyDataSet(value)[i][0]))

ew !
You're converting the same dataset to a pydataset once per row !
You could use dataset.getValueAt() instead:

for i in range(value.getRowCount()):
    labelList.append(value.getValueAt(i, 0))

Or first convert to a pydataset, then loop through it:

ds = system.dataset.toPyDataSet(value)
for row in ds:
    labelList.append(row[0])

But there's actually a better, built-in way to do this:

labelList = value.getColumnAsList(0)
3 Likes

Your piechart doesn't work because your first label don't have a value in it:
image

Your query result shows the same issue:
image

Thanks!!!!