LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I make values default in global VI during runtime?

I have a sub VI that is providing values to a global VI to be used later in my program. Is there a way to save the values as default after they have been written to the global vi during runtime?
0 Kudos
Message 1 of 3
(2,826 Views)
Hi.

To change the default values of any VI, you need to open a reference to that VI (it doesn't matter if it is a subVI, you specify the path to the VI) and use an invoke node to make the current values the default valuess. I am attaching a little image with such a code. You can find all the nodes in that code in the "Application Control" subpalette of the functions palette.

You must be aware, though, that changing the default values of a VI, requires saving the VI file with the new default values, which means that the VI must be writable (you must have write privileges for that file, and you cannot use this feature if the VI is an executable).

Hope this helps.

Alejandro
0 Kudos
Message 2 of 3
(2,820 Views)
You can't actually cahnge the default values during runtime. Doing so requires the VI to be recompiled, which is why it must be saved. A VI can only be recompiled if it not running or reserved to run (a subVI/Global in a running top level).

The best way to handel this would be to write the new values to a config file. Then you can read the values from the file and update the Global. Look on the Functions palette in the "File I/O>Configuration File VIs" sub palettes for the config file functions.

There's also an OpenG package to make working with config files a bit easier. Check out the OpenG Commander for easy management of several packages.

Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 3 of 3
(2,810 Views)