NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to solve error using local variables?

I've created a sequence with a local variable.
But when I execute it, an error occurs since the first step (before the step where I manipulate the local variable).
The error code is something like:
Error in Evaluation. Syntax expression. Column [0-0]

It's interesting because it seems that once I've executed my sequence for the first time I can't create any other sequence where this error doesn't appear.
0 Kudos
Message 1 of 5
(2,487 Views)
1) Does this only occur when you are using this particular sequence?

2) How are you executing your sequence - Test UUTs, Single Pass, or Execute MainSequence? Do you get different behavior depending on how you execute it? Perhaps it only occurs when you use a process model entry point.

3)Can you send a very simple sequence with which I can reproduce the error?

4) If you create a brand new sequence with the same local variables does the error also occur with the new sequence? Perhaps you sequence has somehow been corrupted.

5) This type of error usually occurs when you have a syntax error in one of you expressions. The error usually reports at what step and in what sequence the error occurs. I believe that there is more information in the error that would allow you t
o localize the problem to the expression in which the error is occurring. What is the remainder of the error message and what is the expression in which the error is occurring?

6)What version of TestStand are you using?

7) You mentioned an interesting problem at the end of you questions. Does this problem go away when you
a) restart the sequence editor?
b) select File>>Unload All Modules?
If you have not tried b), what happens when you do try it under the circumstances you have given?

I hope this helps. If not then some the answers to the questions above should provide some insight.
Message 2 of 5
(2,487 Views)
Nemo,

Thanks for your attention.

Here are the answers for your questions.

1) Since the error occurred for the first time, it occurs with all new sequences.

2) The behavior is the same for every mode of execution.

3) I put a simple sequence attached to see if you can reproduce the error. I put a breakpoint on the label step and add a watch on the local "nls". The error appears.

4) YES. The error occurs in new sequences.

5) The error is:
Evaluation Failed: Syntax Error Expression. (Column 0-0)

6) Test Stand Version 1.0.3

7) Restarting sequence editor: No Change.
Unloading all modules: No Change.


I'm just a begginer using Test Stand.
Is possible that I'm doing the wrong procedure to create local variables ?

Just one more question:
W
hat's the best way to pass three paths strings to a VI. These paths are supposed to be constants. What's the best way to create three constants in LabVIEW and pass them to a LabVIEW VI that is a step?

Nemo, thanks a lot for your help.
If possible, could you send the answers with copy to pdparo@yahoo.com ?
0 Kudos
Message 3 of 5
(2,487 Views)
Pparo,

The problem does not occur under TS 1.0.3 on my system. However, I think we can get to the bottom of this.

When at a breakpoint in your sequence, if I type the expression "Locals.nls == 15-" in the TestStand watch window, I will get the message

Evaluation Failed: Syntax error in expression (Column 18-18)
I believe that this is the same type of error that you have encountered. Correct me if I am wrong.

The numbers after the word "Column" indicate where the error has occurred in the expression. In your case the error occurs at the beginning of an expression. The question still remains as to in which expression is error occurring.

Are you seeing this error reported in the watch window? If so, then you have typed the expression in the watch window.

If I copy the bad expression above into a the expression of a Statement step I get a run-time error of

An error occurred in the 'Statement' step of the 'MainSequence' sequence in 'Sequence File1'.
The post-expression for the step 'Statement' could not be evaluated.
Syntax error in expression.
Error Code: -17322


From what you report, the error appears to be located in your watch expression. When I executed your sequence with a breakpoint on the first step, I added the watch expression by selected the Context tab, expanding the Sequence Context tree view until I could see the nls variable, and then I dragged nls from the tree view to the watch window. This created the watch expression of Locals.nls. I also created the same watch expression by right clicking in the watch window, selecting Add Watch from the context menu, and selecting (or typing) Locals.nls. The expressions all evaluated to 24 without error.

This process has NOTHING to do with creating local variables. You asked if you are creating variables properly. There are only 2 ways to create variables in TestStand 1.0.3, neither of which you have described. The most common method is to select the Locals tab after opening your sequence (not during execution), right click in the right pane and add the variable of your choice. It seems like you did this correctly based on the sequence file you sent. The other method of creating variables is to do so programmatically. However, this is beyond the scope of this answer.

You ask a question about "the best way to create three constants in LabVIEW and pass them to a LabVIEW VI that is a step?" This implies to me that you want to create the strings within a VI called by one sequence step, and then use them in another VI called by a different sequence step. I would recommend taking a look at the example AccessingPropertiesAndVariables.seq that ships with TestStand. The first 3 VIs write values back to step properties, but could just as easily write them back to local variables. The 4th VI writes a file reference back to a TS local variable. The 5th and 6th step get the file reference from the TS local variable. You want to do something similar to the 4th and 5th VI, however, you want to send 3 strings to local TS variables, and then get them in the following VI. This will require using "TestStand - Set Property Value (String).vi" and "TestStand - Get Property Value (String).vi" which can be found in the TestStand function palette in LabVIEW. After reviewing this example you can then ask additional question. I recommend posting the question on a different thread since it is unrelated to your original question about the syntax error.
0 Kudos
Message 4 of 5
(2,487 Views)
Nemo,

I got it.
I was adding a watch in a wrong way!
I followed your instructions and everything worked properly. Silly mistake 🙂
Thanks a lot for your help!!!
0 Kudos
Message 5 of 5
(2,487 Views)