LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

global variable readonly

I chose to try/use a global variable to resolve a complex situation I was having.  I followed the "Creating Global Variables" from LabVIEW help and everything seemed to work fine.  The global stopped working, however, when I checked my files into CM and the xxxGlobal.vi (created by the global variable process) was readonly.  I didn't see a runtime error, but the global always returned the default.  Then, when I changed the file's attributes (enchecked readonly), I could exercise the other functionality.

 

Is this a known issue - do I have to make this global.vi read/write for all users, or is there another solution?

0 Kudos
Message 1 of 5
(3,615 Views)
What is "CM" ??
0 Kudos
Message 2 of 5
(3,613 Views)
CM = Configuration Management.  While developing, the files are read/write.  Once they get checked in, they become protected (readonly). 
0 Kudos
Message 3 of 5
(3,611 Views)

I don't think my conclusion (above) is correct.  I had a case statement error that made it appear that the readonly was the issue, when it was not.  I'm not sure what the deal is now.  Here is what I did.

 

I placed a global variable(gv) in the block diagram of one VI, then double clicked on the gv and got a blank vi.  I dropped a text control onto the front panel and named it ReportFormat.  I then did a "save as" to save the new (global) VI.  I then added some logic (where I originally dropped the gv) to populate the global variable with the user's selection from a drop down (two possible choices) .  I then went to another VI and in its block diagram I did a "Select VI", found/selected this global.vi I just created.  Since I only have one item on the front panel (in the global.vi), I received an association to ReportFormat.  I did a  "Change to Read" so I can use the string output to drive a case statement.  The default case is always selected, though.

 

 

0 Kudos
Message 4 of 5
(3,599 Views)

It sounds like you're using the global correctly, but my guess is that you simply didn't write a value into the global. You can do this manually or in the code. Of course, you also need to make sure that you don't overwrite the value. In general, globals can be dangerous, as they have a potential for creating race conditions (at least if you have more than one writer), but if your use case is simple, you can probably use it safely.

 

I assume the example finder (Help>>Find Examples) probably has some examples for using globals, so you can try searching it.


___________________
Try to take over the world!
0 Kudos
Message 5 of 5
(3,568 Views)