LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Relinking Global Variables

I'm using LV 6.02 and needed to reorganize my global variables into 2 - 3 separate global VI's. I realize that after doing this that I need to relink each global reference to the appropriate global VI. However, when I write-click on any of the global references in my application, the option to relink to SubVI is grayed out. Any suggestions? Thanks in advance!
0 Kudos
Message 1 of 4
(3,463 Views)
Hi,
to relink your global variable to the new VI you have to do the next thing:
1. Right-click on the global variable on the block diagram and select "Replace" from pop-up menu.
2. Then goto "Functions->Select a VI..." button (left-bottom coner) and select a new vi with global variable.
3. The variable will be replaced.

Good luck.

Oleg Chutko.
0 Kudos
Message 2 of 4
(3,463 Views)
Is there anyway to do this on a large scale (e.g., I have several hundred globals scattered among perhaps a hundred or so subVIs. It would be convenient to be able to select an option where Labview would search all your global VI references and definitions and relink them for you.)
0 Kudos
Message 3 of 4
(3,463 Views)
> Is there anyway to do this on a large scale (e.g., I have several
> hundred globals scattered among perhaps a hundred or so subVIs. It
> would be convenient to be able to select an option where Labview would
> search all your global VI references and definitions and relink them
> for you.)
>

Interesting that you might ask. This is what LV does each time it loads
your VIs into memory. The deal is, your VIs are referring to by a file
name and a global element name. The relink subVI item will be grayed
out unless LV was unable to find the VI the first time. This will
provoke it to perform the search again looking for a file with the right
name, then a global element in the file.

It sounds like you now want to use the same global element name but a
new file name. As pointed out in the previous email, the manual way of
doing this is to replace the global and choose the new file/global element.

To do this more automatically, do the following series of steps, which
work for VIs as well as globals.

Close all VI windows. Because of undo, it might even be a good idea to
quit LV to make sure there are no VIs left in memory. Rename your
current global file to get it out of the way. Rename your new global
file to have former one's name. Now load your application into memory.
Provided the global files contain the same elements, things will have
been auto-replaced and you are on your way. More than likely, you will
find some elements missing or misnamed. You can fix these by hand or
kick them out of memory, correct the issues with the global files and
reload.

As I said earlier, this is a convenient thing to do when you have a file
used all over and wish to replace it all at once.

Once things are the way you want them, you can change the filename on
your global by opening it and selecting Save As and giving it another name.

On a cautionary note, you might want to consider if you have too many
global references? If many of the references look like, it would be
good to make some subVIs to cut down on the references.

Greg McKaskle
0 Kudos
Message 4 of 4
(3,463 Views)