NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Where is the best description for Statement strings

I am continually running into issues with wrong syntax in the statement expression strings. Where is the best location to describe something like the following:
InsertElements( Locals.SignalNoiseRatio, 1, Locals.ArraySize )
where I want to initialise the array named Locals.SignalNoiseRatio from element 1 to element with the value from Variable Locals.ArraySize
Any pointer as to where to find a summary of expressions would be appreciated.
0 Kudos
Message 1 of 4
(3,221 Views)
Hi ADL,

The Expression Browser is the only place that details the parameters and syntax of the Expression statements.
For the InsertElements() the 2nd parameter; Index, is a string and requires the value to input as "[x]" where x is the index value.

Therefore your statement should be
InsertElements( Locals.SignalNoiseRatio, "[1]", Locals.ArraySize )

Also the Array must already exist and the Index must be in the range of the array bounds. eg if your array was declared but was empty then using the index value equal to 1 would produce an error because it is not within the range of the array bounds.

Sometimes it is better to use the API calls via the ActiveX Adapter because you can set the options to "Insert if missing".

Hope this helps
Regards
Ray Farme
r
Regards
Ray Farmer
0 Kudos
Message 2 of 4
(3,221 Views)
Ray thanks for your advice, and I like the idea of using the API calls through ActiveX adapter, only problem is I've never used the ActiveX adapter (I have used ActiveX within LabVIEW), and would appreciate a starting point, do you know where I can find a example using a sequence statement in a step type through ActiveX adapter.

ADL.
0 Kudos
Message 3 of 4
(3,221 Views)
Hi ADL,

I have attached an example based on your initial statement InsertElements(Locals.SignalNoiseRatio,1,Locals.ArraySize).

The first step uses the API calls to Insert 2 new elements into an empty array. It uses the Locals.SignalNoiseRatio as a reference. Using this reference you can then use the PropertyObject methods. A list and descriptions of the methods can be found in the TestStand Programmers Reference Manual. Also when you specfiy the Module you will be able to invoke the help from the Specify Module dialogBox. Once the Array contains elements the SetNumElement() will nolonger work you have to use the SetPropertyObjectByOffset.
So the next step get a reference to an element in the array. This is used in the third step which will
insert elements for the same type into the array.

I have also added an alternate method if you wish to insert a new value into an array. This step loops for Locals.ArraySize and inserts the value of the Loop Counter+1 into each element.

As for other examples, there are examples using the ActiveX adapter on NI website and also within The examples provided with TestStand. There have also been useful examples posted on the Forum pages.

Hope this get you started
Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 4 of 4
(3,221 Views)