I have data that looks like in the below image. In this case, I manually added the items in the tree.
Also, each item in the tree has a unique tag associated with it.
I can do this manually, but when I am trying to do the same using the 'Edit Tree Item.Add Item' method from the Invoke node, it looks like:
I am attaching the vi that I used for this. Please take a look and let me know how I can make it work.
Thanks
EDIT: Now with Labview code
In a tree, each entry has a tag, and is linked to a parent entry by the tag of the parent. That is: Element1 is a child of Project, and Project is the parent of Element1. Likewise, Element1 is the parent of Subelement1 and Subelement2. And Project? It is on the root level, and has no parent, so its parent tag is empty.
There are two ways to fill the tree:
This node has inputs ChildTag
and ParentTag
. If ParentTag
is empty/not connected, the item is placed on the root level. Use ParentTag to link an entry below another.
Pro:
Con:
This node gets an array of items as input, which are inserted into the tree in the order they are in the array. Each of them has a numeric ItemIndent to control the structure of the tree.
Pro:
Con:
Here is an example snippet (you can drag the image into an empty LV blog diagram!) showing both methods: