From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Sam_Sharp

TestStand Expression Macros

Status: Duplicate

I'm closing this and adding a link to this description in the other post.

https://forums.ni.com/t5/NI-TestStand-Idea-Exchange/Expression-Variables/idi-p/2678825

Let's say I'm building a fairly long compound expression that has some repeated parameters - I would like a way to specify (without creating additional locals) a variable/macro for use just within that expression.

 

For example, instead of:

Locals.CommandLine = "cmd /c C:\some path\that\is\reused"
Locals.CommandLine += " /path C:\some path\that\is\reused"

 

 

I could specify:

#pathmacro "C:\some path\that\is\reused"
Locals.CommandLine = "cmd /c " + pathmacro
Locals.CommandLine += " /path " + pathmacro

 

 

The idea being that with this I only need to update the macros in one place in a long expression.

 

This is a simple example, but hopefully you can see why this would be useful and why I wouldn't want to create lots of locals when the values are required only within the expression.


LabVIEW Champion, CLA, CLED, CTD
(blog)
3 Comments
paulmw
Active Participant
RustyStrings
Member

I believe that I suggested that TestStand use macros many years ago.

Or it may have been to define constants that could be used for things like hardware addresses

 

I think a define statement would be great.

 

instead of:

Locals.UUT = RunState.TestSockets.MyIndex+1

 

have something like this in a special macro sequence (or anywhere for that matter)

#DEFINE UUT = RunState.TestSockets.MyIndex+1

 

Even if you need to prefix with a special character like ~

~UUT = RunState.TestSockets.MyIndex+1

 

then you could just use ~UUT for RunState.TestSockets.MyIndex+1

 

I dislike having to use variables for data that doesn't change

 

Perhaps it is just beyond the capabilities of TestStand

 

 

 

 

 

 

WireWeaver
Active Participant
Status changed to: Duplicate

I'm closing this and adding a link to this description in the other post.

https://forums.ni.com/t5/NI-TestStand-Idea-Exchange/Expression-Variables/idi-p/2678825

https://www.linkedin.com/in/trentweaver