NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there somehing similar to #define (in C) in TestStand

HI,

Many times I need to specify numeric (or string) values in globals. I was wondering if there something similar to #define so you can enter a "name" isstead of a number.

Thanks

Rafi
0 Kudos
Message 1 of 6
(3,763 Views)
You can use either a Sequence File Global or a Station Global. If you don't ever change the value, it will be like a constant. Sequence File Globals are global to the sequence file opened and all sub sequences in it. To create one, on the sequence file window, click the down arrow next to Main Sequence. Select Sequence File Globals. On right hand pane, right click and select Insert Global, then Numer or String or whatever type you desire. Then double click on the newly created global and a window pops up that allows you to assign the value. The value remains constant unless you re-assign it. You can access the global by using FileGlobals.XXX, where XXX is the name of your global.
Station Globals are global to all sequence files on that station. Create by going to the menu bar and clicking on View - Station Globals. Again right click on the right hand pane to create one. Assign a value in the same manner as above. Access it by using StationGlobals.XXX. Once a global is assigned a value, and the sequence file is saved, the next time you open the file, that global will retain the value assigned. No need to assign again.
- tbob

Inventor of the WORM Global
Message 2 of 6
(3,754 Views)
Hi,

Dont forget, if you use multiple sequencefiles, you will have to set the sequencefile properties to use the same FileGlobals. By default each sequencefile is set to use seperate FileGlobals.

Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 3 of 6
(3,745 Views)
It would be great if the FileGlobal variables (and others) had a way to set them as "Read Only" so that they could not be changed, making them a "Constant".

Define the variable, set the value and Right click the variable definition, and have a "Read Only" option.

Mike
0 Kudos
Message 4 of 6
(3,731 Views)
Mike,

This is not exactly what you suggested, and there is a property flag that can be set for a FileGlobal to prevent the user from editing the object or deleting its properties in a sequence editor. The flag is PropFlags_NotEditable. Of course, once you set this flag you will not be able to unset it since the FileGlobal is now not editable.

You can get to this flag by right clicking on the variable and selecting Properties…. Click on the Advanced… button and you will see a list of Flags in the Edit Flags window.

You could also submit the suggestion you made in NI’s Product Suggestion Center linked below.

Product Suggestion Center

Regards,

EricM
0 Kudos
Message 5 of 6
(3,713 Views)
Eric,

I've added the suggestion.

Thanks.

Mike
0 Kudos
Message 6 of 6
(3,691 Views)