# Filling a Tree Control

**URL:** <https://forum.inductiveautomation.com/t/filling-a-tree-control/1802>\
**Category:** Ignition\
**Created:** [May 4, 2010, 1:44pm UTC](https://forum.inductiveautomation.com/t/filling-a-tree-control/1802 "2010-05-04T13:44:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TimE](https://avatars.discourse-cdn.com/v4/letter/t/ee59a6/32.png) [@TimE](https://forum.inductiveautomation.com/u/TimE)\
**Post date:** [May 4, 2010, 1:44pm UTC](https://forum.inductiveautomation.com/t/filling-a-tree-control/1802/1 "2010-05-04T13:44:05Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [May 4, 2010, 5:19pm UTC](https://forum.inductiveautomation.com/t/filling-a-tree-control/1802/2 "2010-05-04T17:19:08Z")

</div>

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.
