NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing FileGlobals variable using GetValNumber in C#

Solved!
Go to solution

When attempting to access a FileGlobals variable with the following line of code in a C# GUI, I encounter an "Unknown variable or property name" exception.

 

double tm2 = axExecutionViewMgr.Execution.AsProperteryObject().GetValNumber("FileGlobals.TM2", 0);

 

 

The exception can be duplicated using the "Simple Test Executive Operator Interface Example" supplied with TestStand 2010 SP1, add a Windows Form button, and a button_Click  event handler with the code above in it; Then run a TestStand sequence from the interface that contains a FileGlobals.TM2 variable and click the button.

0 Kudos
Message 1 of 2
(3,269 Views)
Solution
Accepted by topic author JeffC

File globals are per sequence file. You need to do this instead:

 

PropertyObject mySequencesFileGlobals = axExecutionViewMgr.Execution.GetFileGlobals(mySequenceFile);

 

double myval = mySequencesFileGlobals.GetValNumber("TM2", 0);

 

See the API help for more details for these APIs.

 

Hope this helps,

-Doug

Message 2 of 2
(3,198 Views)