LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dealing with Duplicate Entries in Drag and Drop Tree Control

I am programmatically creating a tree control from which a user can drag and drop into other tree controls for further use. I'm having trouble trying to implement code to deal with duplicate entries when dragging the child tag of my tree control from one tree to the other. I'm using the Match Pattern VI to find if the new tags being added are equal to those that were already existing, but for some reason the match offset pattern is equal to -1 even for strings that are exactly the same. Here is a snippet of the code:

robv1234_0-1753125849558.png

I will also attach the VI to the bottom of this thread. Help would be appreciated.

0 Kudos
Message 1 of 5
(117 Views)

You actually attached a 2025 version of the VI.  Most of us can't open it.

0 Kudos
Message 2 of 5
(77 Views)

Why are you using "Match pattern" if you're only caring about an exact match?  Why not use the standard "Equals" node?

 

Match pattern should be used when you expect at least some differences.  Maybe you think it might match only a substring, maybe you want to disregard differences in whitespace, and so on. 

 

If you're using it just to look for only exact matches, you risk missing the matches if the "match" string contains control characters like square brackets or periods, and risk false positives for matches if the string you're checking contains the "match" string as a substring.

0 Kudos
Message 3 of 5
(67 Views)

If you're looking to match exact values of strings but would like to be case insensitive, use a "To lowercase" function before both items then compare as equal.

0 Kudos
Message 4 of 5
(65 Views)

Tree ctrl won't allow duplicated tags.

If you already have a tag "abc", when you try to add another "abc", you will get "abc_1", although in display you have 2 "abc".

I can't open your VI.  I don't know what you use in Frames & Signals.

 

George Zou
0 Kudos
Message 5 of 5
(54 Views)