NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing the Value of TS local using CVI

Hi,
I am writing an application using CVI that is running on TestStand 4.0 and using the TS_PropertySetVal... functions to change the value of TS locals. I can see that the locals do change during the run but when the sequence finishes it returns to the initial value. I want it to stay with the latest values configured by my aplication. I only managed to do so with the StationGlobals but not with the Locals or Parameters.
Any Ideas?
Thanks,
Moshik 
0 Kudos
Message 1 of 4
(3,431 Views)

Hi Moshik,

The behaviour you see is to be expected with Locals.
It's the same rules of scope as in C programming.

Try using Sequence FileGlobals to maintain variable values between executions.
Remember to set your Client Sequence File properties so that each execution
shares the same FileGlobals (TS Editor: Edit -> Sequence File Properties).

Gary.

0 Kudos
Message 2 of 4
(3,423 Views)

Hi,

To change the static version of the variable use the lookup string "RunState.InitialSelection.SelectedFile.Data.Seq[<sequence_name>].Locals.<variable_name>" instead of the Locals.<variable_name>.

eg

if your locals was in MainSequence and call MyNumber, the lookup string you would use would be;

"RunState.InitialSelection.SelectedFile.Data.Seq[\"MainSequence\"].Locals.MyNumber"

plus you also will need to set the runtime version as well using Locals.MyNumber

Use the same CVI TS function to set the static version as you use for the runtime version.

Because you are changing the static value you have to increment the count of the SequenceFile to indicate its dirty (ie something has changed in the file). If you dont do this, when you close the sequence file, you will not be prompted if you want to save changes.

Hope this helps

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 3 of 4
(3,416 Views)
Hi,
Ray and Gary - Thanks for the reply.
I did try it with file Globals but it did not work.
I want to do it a simple as possible so I decided to go on the Station Globals option and it seems to work fine for now.
Thanks,
Moshik
0 Kudos
Message 4 of 4
(3,385 Views)