01-22-2010 10:53 AM
Hi there,
I've ran into a mess with my global variables. While I was trying to rename one of the globals, all instances in hundreds of subvis turned corrupt. The icon of the global variable turned black and the wires starting at the variable became broken. The amazing thing is that the black icons seem still to be linked to the correct global variable. If I leave the mouse cursor on the icon, the correct file path appears in the context help window. If I double click on the corrupt icon, the correct vi is opened. I tried "Save as" and "Rename" with various options. LabVIEW seems to browse through all affected vis but the icons remain broken. My last hope was to run the "Find and replace" tool (Ctrl + F), but it doesn't work for global variables for some unknown reason, unfortunately. Compare
http://forums.ni.com/ni/board/message?board.id=170&message.id=438450&query.id=2151294
Is anybody out there who has a useful hint?
Peter
01-22-2010 10:57 AM
Hi stoeckel,
wow, globals in hundreds of subVIs...
Probably LabView only lost the connection to an item of the global VI, but not to the global VI itself. Did you rename any of the items?
My suggestion: Pick a recent backup and replace the broken global with it's older version.
01-22-2010 01:34 PM
Hmmmm... Global variables and a mess. Gee, these two always seem to crop up together.
It sounds like you were renaming a global without all of the VIs loaded into memory. The safest way to handle changes in global variables is to make sure all VIs are loaded into memory. Thus, when the global variable is renamed, all of the links are updated in-place and you can save all of the updated VIs.
01-22-2010 01:42 PM
finding global variables are a pain before you have broken them. Finding a global variable sucks anyway since it ctrl-f will find all globals on the same global vi not just a single instance. One thing you can try is to go to the brojen global and see the lable text associated with it, then do a find on text instaed of a find on the global.
01-22-2010 03:18 PM
01-25-2010 09:30 AM
Hi there,
thank you all for your contributions. We were able to solve the problem in the meanwhile. Why did nobody point us to the fact that the icons of global variables turn black if the name of the control on the panel of the variable does not match the selected name inside the icon?
If somebody just quietly mentions the existence of "global variables" he or she will usually be soused with flout and bashed by the proven active veterans. But why's that? Global variables can provide an easy way to communicate a "stop" information throughout all running vis. As long as there is just one writer and many readers, there is no danger that it comes to "race conditions".
If global variables are really so nasty as is often said, why does National Instruments still provide them within LabVIEW??
Peter
01-25-2010 09:37 AM
stoeckel wrote:Hi there,
thank you all for your contributions. We were able to solve the problem in the meanwhile. Why did nobody point us to the fact that the icons of global variables turn black if the name of the control on the panel of the variable does not match the selected name inside the icon?
If somebody just quietly mentions the existence of "global variables" he or she will usually be soused with flout and bashed by the proven active veterans. But why's that? Global variables can provide an easy way to communicate a "stop" information throughout all running vis. As long as there is just one writer and many readers, there is no danger that it comes to "race conditions".
If global variables are really so nasty as is often said, why does National Instruments still provide them within LabVIEW??
Peter
I'll venture a guess!
I did not know that fact since I avoid globals and have very little experience with them aside from them causing race conditions in the first VI I tried to use them in and a never explained delay when trying to read from them inside a Timed loop.
Re Why does N....
Good question! it has been asked by many people over the years.
Ben
01-25-2010 09:46 AM
stoeckel wrote:Hi there,
thank you all for your contributions. We were able to solve the problem in the meanwhile. Why did nobody point us to the fact that the icons of global variables turn black if the name of the control on the panel of the variable does not match the selected name inside the icon?
The LabVIEW compiler would have told you that right away. If you click the broken run arrow on the situation you will get the message:
An item with the specified name could not be found. Select a different item from the list.
Seems pretty straightforward to me. But then, perhaps it's because I've been using LabVIEW for some time.
If somebody just quietly mentions the existence of "global variables" he or she will usually be soused with flout and bashed by the proven active veterans. But why's that? Global variables can provide an easy way to communicate a "stop" information throughout all running vis. As long as there is just one writer and many readers, there is no danger that it comes to "race conditions".
If global variables are really so nasty as is often said, why does National Instruments still provide them within LabVIEW??
I don't want to get into yet another global variable debate here. The only comment regarding global variables made in this thread was a tongue-in-cheek comment I made. I was not dissing global variable. In fact, I use them quite often. Global variables, like every other programming construct ever invented have their use. The main reason you will see the so called "proven active veterans" go crazy over global variables is that they constantly see them being abused, causing race conditions, and then have to listen to newbies complain that their program doesn't work and LabVIEW sucks, when it's really their programming skills that's the real problem. But that's just my opinion.
01-25-2010 09:57 AM
Dear all,
let there be global variables also in future! They work and serve a useful purpose if they are applied in the right way.
Thank you once again for your contributions. LabVIEW is a great programming language supported by a great community.
Peter