04-06-2016 07:55 AM
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.
04-06-2016 08:18 AM
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))
04-06-2016 08:39 AM
Himanshu,
I believe the syntax you are looking for is:
"StationGlobals.Settings.Communication_Protocols.ps
If you don't add quotes around the StationGlobals.Settings.Communication_Protocols.ps
As pulidotech mentioned, if you are trying to get the value associated with the variable, you can use the Evaluate() function.
04-06-2016 08:53 AM
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.
04-06-2016 08:57 AM
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.
04-06-2016 09:10 AM - edited 04-06-2016 09:12 AM
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.
04-06-2016 09:43 AM
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.