NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

APIs for Station Globals

Hello,

Could someone please point me to the TS APIs to Create/Set/Get/Delete Station Global variables?

Thanks,
Sriharsha
0 Kudos
Message 1 of 5
(3,520 Views)
All the methods are using the PropertyObject class.

Getting Values - GetValNumeric, GetValString, GetValBoolean, etc...

Setting Values - SetValNumeric, SetValString, SetValBoolean

Creating Variables - Same as above, but use the InsertIfMissing flag (0x1) for the options parameter).

Deleting Variables - DeleteSubProperty

Hope this helps!

Allen P.
NI
0 Kudos
Message 2 of 5
(3,516 Views)
Allen,

I tried the following code, but it does not seem to work:

            PropertyObjectFile sgFile = m_TSEngine.GlobalsFile;
            sgFile.AsPropertyObject().SetValBoolean("Temp", PropertyOptions.PropOption_InsertIfMissing, true);
            sgFile.SaveFileIfModified(false);
            m_TSEngine.CommitGlobalsToDisk(false);

After I run the code can I do not see the Variable Temp created under StationGlobals. Please let me know what is wrong.

Thanks,
Sriharsha

0 Kudos
Message 3 of 5
(3,514 Views)
Engine.GlobalsFile is a PropertyObjectFile, not a PropertyObject.

Use Engine.Globals instead.
0 Kudos
Message 4 of 5
(3,511 Views)
Howdy Sriharsha,

Attached is an zip fle with an example sequence that uses two activeX calls to insert a Station Global variable.

Hope this helps!

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 5 of 5
(3,495 Views)