Random Ramblings on LabVIEW Design

Community Browser
Showing results for 
Search instead for 
Did you mean: 

Tree Control - A Little Present

Active Participant

What-ho G-Programmers of the world!

If like me you find programming the tree control to be a pain in the bum you may be interested in this little bit of code.

With it you can take a database table and create a tree hierarchy


So the table above will create a tree that looks like this when you use the query SELECT * FROM experimentTree


Going back the other way we want to generate SQL INSERT statements (this is SQLite flavour) or a table of data to parse back.


The code to generate this is included in the teststub. As a separate statement or as part of the main statement you should also empty the table.




The front panel of the teststub looks like this

Front Panel.jpg

To get a tree from the database the block diagram looks like this.


To plant a tree in your database, the block diagram looks like this.


For simplicity I have contrived the tags. For my purposes I will be linking the selection to an experiment, obviously your requirements may differ, in essence the experiment field will be a foreign key into another table.

It's in LabVIEW 2014, but I can down-version if required.

Perhaps this will help make tree-huggers of us all

Much Love



Nice code , tree controls can be a pain to set up so this will be useful.

I like the term 'plant' the tree

Active Participant

It's the little things, it was my favorite bit too!

It's pretty robust (as a quick bit of experimental code) which bodes well for the future. I was dragging the tree nodes around and it was saving them really well.