Quick Drop Enthusiasts

Reply
This is an open group. Sign in and click the "Join Group" button to become a group member and start posting.
Highlighted

Search for Shared Variable

I was looking to create a quick drop to search my project for calls to a shared variable.  I believe that I would need to search the project by the variable's name to find the point-of-use within VIs.

 

My first attempt can see that it is a shared variable, but I can't find a way to get it's name.  At the very minimum, I would like to copy the name to the clipboard.

0 Kudos
Message 1 of 17
(334 Views)
16 REPLIES

Re: Search for Shared Variable

You can read the Label.Text property of the Shared Variable node. It will always be the target namespaced name of the variable, like "My Computer\abc.lvlib\Variable1".

 

Also, you should consider implementing this feature as a Right-Click plugin instead of a Quick Drop plugin, since right-click plugins are more suitable for more context-sensitive operations, like operating only on certain objects.

DNatt, LV R&D
0 Kudos
Message 2 of 17
(332 Views)

Re: Search for Shared Variable

As an alternative you could just do a text search for the name of the shared variable using the search window that already exists.  Just "CTRL+F".  Works really well.  I had to re-architect an application with hundreds of shared variables and got through it that way.

Certified LabVIEW Architect
0 Kudos
Message 3 of 17
(328 Views)

Re: Search for Shared Variable


@ wrote:

As an alternative you could just do a text search for the name of the shared variable using the search window that already exists.  Just "CTRL+F".  Works really well.  I had to re-architect an application with hundreds of shared variables and got through it that way.


That is a great tip!  The end result is what I was hoping to achieve.  This is likely to be my final solution.

0 Kudos
Message 4 of 17
(312 Views)

Re: Search for Shared Variable


@ wrote:

You can read the Label.Text property of the Shared Variable node. It will always be the target namespaced name of the variable, like "My Computer\abc.lvlib\Variable1".



That is what I was looking for.  If I just use GObj, I can only get the class name.  If I cast it to a Variable, Label.Text isn't available.  If I cast it to a control, Label.Text is there, but doesn't show anything.

0 Kudos
Message 5 of 17
(311 Views)

Re: Search for Shared Variable

I was referring to the Label.Text property of the SharedVariableNode class...I had assumed you were referring to shared variable nodes on the block diagram.

 

1.png

DNatt, LV R&D
0 Kudos
Message 6 of 17
(301 Views)

Re: Search for Shared Variable


@ wrote:

I was referring to the Label.Text property of the SharedVariableNode class...I had assumed you were referring to shared variable nodes on the block diagram.

 

1.png


OK, now I found it.  I just needed to enable VI Scripting to see it.

 

Now that I have the string I need, how would I pass it into "Find and Replace..." or go straight to "Search Results"?

0 Kudos
Message 7 of 17
(291 Views)

Re: Search for Shared Variable


@ 2ndTime wrote: 
 

Now that I have the string I need, how would I pass it into "Find and Replace..." or go straight to "Search Results"?


Unfortunately, there is no G interface to the Find and Replace feature.

DNatt, LV R&D
0 Kudos
Message 8 of 17
(284 Views)

Re: Search for Shared Variable


@

Unfortunately, there is no G interface to the Find and Replace feature.


OK, thanks for the info.  I appreciate it.

0 Kudos
Message 9 of 17
(281 Views)

Re: Search for Shared Variable

One workaround I've employed is to use the VI Analyzer to write a test that not only finds particular objects, but also uses scripting to modify the VI. I talk about this technique and give a demo toward the end of my VI Analyzer presentation.

DNatt, LV R&D
0 Kudos
Message 10 of 17
(279 Views)
Reply
This is an open group. Sign in and click the "Join Group" button to become a group member and start posting.