Filling a Tree Control

Hi,

I am experimenting with the tree control and I am trying to figure out how to use an existing set of data to populate the tree.

I have an asset table that was previously used with a tree control in VB. To fill the tree I would use the following columns:

nodeID - Identity
parentNode – contains the nodeID of the parent leaf
assetName – Text description of the leaf

The root nodes consist of all items where parentNode = 0
Once the root nodes are identified I then iterate through the list one by one finding child nodes where nodeID = parentNode. I have used two different methods. One where all nodes are filled in at startup and the other where the child nodes are populated when it is clicked.

Since the tree control in ignition is populated by containing the entire path for the node in a column is there a way for me to create this path in SQL or will I have to manually convert this table?

I think you will have to fill the tree view dataset through scripting. I don’t think you can do it with SQL since the tree view expects a path separated by some character such as a /. Here is an example dataset:

path text Node A Node A Node B Node A/Node B Node C

This would make a tree view look like:

Node A Node B Node C

If you need help writing the script let us know.