LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reset all globals to default on run?

Howdy all,

Would it be possible to automatically reset all globals to their defaults when you run a VI that uses them?
The first time it works fine but after that the globals are in memory and if you stop the main VI and start it again everything keeps their last values instead of the defaults.
Any hints would be appreciated, solutions even more 🙂

Jeroen
0 Kudos
Message 1 of 4
(3,065 Views)
In aplications I usually don't use globals but memory vi's with unitialised shift registers.
On start of the application, an init call to the vi loads in the values from a set-up file.

What you could do in your situation (although newer features of LV seem to catch up the old work-arounds more-and-more) is add an extra bolean global. Set this if you change any of your globals. If you init-call the vi, check this boolean and reload your globals with the defaults (copy from some constants).
0 Kudos
Message 2 of 4
(3,064 Views)
If you are using LabVIEW 6, then open a reference to the global and use an Invoke node with the method "Reinitialize All To Default". Don't forget to close the reference when you are done with it. This sound like the type of action you are looking for.

Rob
0 Kudos
Message 3 of 4
(3,064 Views)
One caveat about this solution is that it doesn't work for built applications. In this case, you'll have to read the defaults from an .ini file or set them from another global.
0 Kudos
Message 4 of 4
(3,064 Views)