Jump to content

Troubles with Tree


Recommended Posts

Hello,

I am trying to generate a tree from a table of data. For some reason I cannot figure out how to get the parents to show correctly. I am attaching the image below illustrating my problem. The first column is suppsed to be the parent and the second column is supposed to be the child.

Does anybody have any suggestions on how to correct this?

Thanks

post-15-1083268858.gif?width=400

Link to comment

Actually LabVIEW is doing exactly what you are telling it to do. LabVIEW does not care what order you create things in. You can build the tree out of sequence. The only thing that matters is the parent tag. In your case you are telling all the childs to attach themselves to a parent that has a tag with the label "a". If you look at the LV help you will read this:

Child Tag: A unique tag for the new item. The default is the string you wire to Left Cell. If an existing tag already uses that string, LabVIEW appends a number to the string to create a unique tag for the new item.

So this means that the new parents will have the following tags:

a

a_1

a_2

You can see this after you run your VI. If you right-click on the tree control and select Edit Items... You will see tag a_1 etc.

So, the key is to attach the child to the correct parent tag. How do you do this? Well LV provides the tag value that was generated for the parent tag. You can use this value for the reference to the child. I've shown you how to do this in the attached image.

post-15-1083295375.gif?width=400

Link to comment

Thanks Michael.

Unfortunately that's not what I am trying to accomplish. I probably did not explain it very well. In my example I am actually trying to set a as the parent for 1, 2 and 3. I accomplish that but I get two additional a parents (actually is No of children -1 additional parents).

i.e.

_a

|_1

|_2

|_3

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.