Random Ramblings on LabVIEW Design

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

Tree Control - A Little Present

swatts
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

database.jpg

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

tree1.jpg

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

INSERT.jpg

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.

DELETE

FROM

          "main"."experimentTree".

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.

GetTreeFromdB.jpg

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

GetdBDataFromTree.jpg

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

Steve

Steve


Opportunity to learn from experienced developers / entrepeneurs (Fab,Joerg and Brian amongst them):
DSH Pragmatic Software Development Workshop


Random Ramblings Index
My Profile

Comments