LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Control Value:Get Method Default Value vs. Real Value

I am looking for some clarification for the Control Value:Get Method for the flattened and variant cases.

 

Documentation is as follows:

The first time you call this method on a VI whose front panel is not open, this method returns the default values of the control or indicator rather than the actual values. Thereafter, it returns the actual value.

 

My question is: If the front panel is NOT opened and I read a certain indicator 2 times, will I get the actual value instead of the default value? (the first time would be a dummy read so the second one would access the actual). If the double-read idea works, does it need to be performed on every indicator that is accessed, or does it only need to be done one time to update ALL of the front panel values to actuals?

 

Example:

I am trying to read indicators X and Y from a closed front pane.

 

I read X once -- I get the default value. I read X a second time, and I get the real value?

 

Do I need to repeat the double read for Y in order to get the actual value?

 

Thanks

-Ted

 

0 Kudos
Message 1 of 7
(4,086 Views)
To me the statement in the Help file makes no sense. If you don't run the VI I don't see how an indicator's value can change, regardless of how many times you read it. You have to run the VI and once you do the first read of the indicator will return the actual value, not the default value. You can see for yourself using the attached example VI.
Download All
0 Kudos
Message 2 of 7
(4,077 Views)
The Help doesn't say after you run the VI, the indicators change. The Help says you have to call the Get Value Method twice to get the actual values if the Front Panel is closed the first time you call it. It's perfectly possible that a VI has run as a subVI, but the Front Panel was never open. This is the case they're talking about.
Jarrod S.
National Instruments
0 Kudos
Message 3 of 7
(4,070 Views)
OK -- so it my interpetration correct then? Do I have to read EACH control/indicator twice to get updated data?
0 Kudos
Message 4 of 7
(4,049 Views)

My unsubstantiated guess is that the first time you call this function to read an indicator in a subVI whose Front Panel isn't open, the Front Panel will be loaded (in some hidden state). At this point, it's still too late to get an actual indicator value, however, so a default value is returned. The second time you call the function, the Front Panel is open, so the function should succeed, even if you're calling it for a different indicator.

 

 

Jarrod S.
National Instruments
Message 5 of 7
(4,043 Views)
OK -- Thanks, I'll just have to set up an experiment.
0 Kudos
Message 6 of 7
(4,036 Views)

Jarrod S. wrote:

My unsubstantiated guess is that the first time you call this function to read an indicator in a subVI whose Front Panel isn't open, the Front Panel will be loaded (in some hidden state). At this point, it's still too late to get an actual indicator value, however, so a default value is returned. The second time you call the function, the Front Panel is open, so the function should succeed, even if you're calling it for a different indicator.


That's precisely what I did in the example I had posted. The subVI has the indicator set to have Inf as the default value. A control with a default value of 23 is wired directly to the indicator. I open a reference to the subVI (that is not open). I read the indicator value twice, then run the VI and read the indicator again. The first and second reads both say Inf. The third read (expectedly) says 23. Now, the question is: what default value is the Help talking about? The default value for the datatype, or the default value that's set for the indicator?

0 Kudos
Message 7 of 7
(4,025 Views)