NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Expression

I am working on batch process model, in my sequence I have declare two file path under StationGlobals. Now I am trying to assign parameter name value with expression and getting error.

Ex:

Define Station global

StationGlobals.Settings.Communication_Protocols.pszIniFile_UUT1 = C:\X\Y\Z1

StationGlobals.Settings.Communication_Protocols.pszIniFile_UUT2 = C:\X\Y\Z2

 

Expression to call file on run time

StationGlobals.Settings.Communication_Protocols.pszIniFile_UUT+"RunState.TestSockets.MyIndex+1"

 

Please correct me in this expression.

Thanks and Regards
Himanshu Goyal | LabVIEW Engineer- Power System Automation
Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
It Only gets BETTER!!!
0 Kudos
Message 1 of 7
(2,587 Views)

I believe that your expression should be:

StationGlobals.Settings.Communication_Protocols.pszIniFile_UUT+str(RunState.TestSockets.MyIndex+1)

 

However, I'm wondering if you want TestStand to evaluate the string, so maybe your expressiong should be:

Evaluate(StationGlobals.Settings.Communication_Protocols.pszIniFile_UUT+str(RunState.TestSockets.MyIndex+1))

 

Pulido Technologies LLC

0 Kudos
Message 2 of 7
(2,580 Views)

Himanshu,

 

I believe the syntax you are looking for is:

 

"StationGlobals.Settings.Communication_Protocols.pszIniFile_UUT" + Str(RunState.TestSockets.MyIndex+1)

 

If you don't add quotes around the StationGlobals.Settings.Communication_Protocols.pszIniFile_UUT, then it will try to evaluate that as a variable before you've appended the socket index. And since the index is a number, we need to cast it as a string.

 

As pulidotech mentioned, if you are trying to get the value associated with the variable, you can use the Evaluate() function.

Jason H
Automated Test Software R&D
Message 3 of 7
(2,571 Views)

Hi Pulido Tech

 

I tried with your solution but getting same error. 

 

Hi Friday

 

If I use "StationGlobals.Settings.Communication_Protocols.pszIniFile_UUT" like this teststand taking it as an string but in my case its variable and I need value inside this variable to call.

 

Actually I have two variables like Local1 and Local 2, both variable contain the file path. now i am trying to write expression based on my socket like if socket 0 is selected seq select path one and on other side if socket 1 is selcted seq select path 2.

Thanks and Regards
Himanshu Goyal | LabVIEW Engineer- Power System Automation
Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
It Only gets BETTER!!!
0 Kudos
Message 4 of 7
(2,566 Views)

I accidentally forgot some quotes, but use Jason's syntax.  

 

For your follow up question, couldn't you just add an if statement to your sequence?  Then, assign the path to the variable in the if and the else sections.

 

Pulido Technologies LLC

 

 

0 Kudos
Message 5 of 7
(2,562 Views)

Hi

 

Same vi is runnig on two places at same time. No point to use if condition as i am working with batch process model.

One example attached here. In this I have one step with two path configuration on run time selection based on socket.

Thanks and Regards
Himanshu Goyal | LabVIEW Engineer- Power System Automation
Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
It Only gets BETTER!!!
0 Kudos
Message 6 of 7
(2,560 Views)

I don't understand your last comment.  In a batch, the locals are instanced per socket, so you can define your locals however you like in every run.  

 

Based on the sequence you posted, I assume you want something like:

((RunState.TestSockets.MyIndex==0) ? Locals.Local1 : Locals.Local2 ) +str(RunState.TestSockets.MyIndex+1)

 

In my example if it's socket 0, the result will be Locals.Local1 + str(RunState.TestSockets.MyIndex+1).  Otherwise, Local2 is used.

 

Pulido Technologies LLC

0 Kudos
Message 7 of 7
(2,546 Views)