Jump to content
Sign in to follow this  
Mike C

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Hi Mike

It seem that you need to initialize the parent first (outside the loop). By doing so I got the following:

a

|_3

|_2

|_1

Cheers

PJM

post-15-1083338005.png?width=400

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
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.

Sign in to follow this  

×
×
  • Create New...

Important Information

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