Populate and Select Tree View with sql query - Perspective :

Hello everyone,
i have a tree view in perspective, i have populate it with a binding query :

I have transform my data with a little script and it work :

but i can’t select the radars from my query for use it after,
I want to create the same items in green with a query, it is possible ? :slight_smile:
Transform my dataset in something other maybe but i don’t find if it is possible.

You’ll have to append a dict for each of your radar values

so it will be like:

items = []
for row in system.dataset.toPyDataSet(value):
      items.append({'label':row[0],'expanded':false,'data':{'something':'other specifics you might add about your radar'},'items':[]})

1 Like

Exactly what i wanted to do, thanks a lot ! :slight_smile:

My pleasure! We are working on more complex nested tree object construction as well, so if you get into a scenario where you need to create multiple nested levels in the tree component let me know.

Hi Alainia, we’ll reach out directly to provide some help.