From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

tree control

Solved!
Go to solution

I have a VI with a tree control.

There is a combo box which which in conjuction with Event Structure adds the text from the combo box to the tree control.

 

Is there a default behavior of the tree control to append a _1 to a tag?

For example, if the combo box text is Test_step1, when 3 of them are added to the tree control I see

Test_step1

Test_step1_1

Test_step1

 

I haven't used a tree control very much. I am at a lost why this is happening.

0 Kudos
Message 1 of 10
(3,267 Views)

Are you sure the last one isn't "Test_step1_2"? The Tags have to be unique, which is why it is appending stuff. You can take control of the tag name when adding items by not leaving the "child tag" input blank:

temp.png

0 Kudos
Message 2 of 10
(3,230 Views)

@Gregory wrote:

You can take control of the tag name when adding items by not leaving the "child tag" input blank:

temp.png


Pretty sure I am not leaving Child Tag blank. Even when it is not blank, the _n still happens.

I have resorted to looping through the 1st column for each cell and getting the cell text.

That is the information that is needed.

 

 

0 Kudos
Message 3 of 10
(3,220 Views)

Ok, I think you would need to post your code to debug any further.

0 Kudos
Message 4 of 10
(3,216 Views)

http://digital.ni.com/public.nsf/allkb/547DFDA3D02FD0AE86257154006933F3

 

I tried the first VI.

 

Instead of using the FOR loop index, I fixed the text as Test1.

And you will see that the tags are unique which is not what I wanted.

0 Kudos
Message 5 of 10
(3,214 Views)
Solution
Accepted by topic author njacacia

If you read the help, you will see that tags must be unique and the documented behavior.

temp.png

0 Kudos
Message 6 of 10
(3,209 Views)

Yeah the tree can appear however you want, but to identify any single item in the tree you need to reference it by an alias, which is the tag, and that needs to be unique for all tags.  So one way to get around this might be to have a Tree look like this.

 

Folder 1

-A

-B

Folder 2

-A

-B

 

But in this case I might have the tags be the following which aren't seen by the user of the software:

 

Folder 1

-Folder 1 >> A

-Folder 1 >> B

Folder 2

-Folder 2 >> A

-Folder 2 >> B

 

This of course only works if you aren't allowed to have two folders with the same name at the same level.  And I mean even if you would allow that how could the user of the software understand what is what?  Anyway just be sure and give unique tags, and one way to help this is to include the full path of the item in the tag.

0 Kudos
Message 7 of 10
(3,197 Views)

@Gregory wrote:

If you read the help, you will see that tags must be unique and the documented behavior.

 


I inherited this tree control VI and unfortunately this documented behavior creates a bug that the original programmer did not fully account for.

I haven't used tree controls in the past so this is all new to me.

 

 

The tree control is being used as a sequencer. The original programmer was using the child tags and the rest of the program is expecting Step1 and not Step1_1, Step1_2 etc.

 

 

0 Kudos
Message 8 of 10
(3,191 Views)

If you don't use underscores for anything else in your tags, you can just "search/split string" to get original step name.

 

temp.png

0 Kudos
Message 9 of 10
(3,181 Views)

@Gregory wrote:

If you don't use underscores for anything else in your tags, you can just "search/split string" to get original step name.

 

temp.png


There are underscores galore in this program. Smiley Frustrated

It is a mess.

I had been told that this program needs a few features to be finished.

I didn't know that some of the even most basic of things are not working.

 

 

0 Kudos
Message 10 of 10
(3,178 Views)