NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Access to locals in the sequence

Solved!
Go to solution
Solution
Accepted by topic author john7

Hi John

 

Use the following Methods

 

SequenceFile.GetSequence ( index) to return a reference to the Sequence


or use

 

SequenceFile.GetSequenceByName ( sequenceNameParam) or by a name

 

ie

 

SequenceFile.GetSequenceByName ( "MainSequence")

 

then once you have your Sequence reference then you can get a PropertyObject reference to Locals.

 Sequence.Locals as a PropertyObject


eg

 Sequence seq = seq_file.GetSequence ( index = 0) (usually for the MainSequence)

 

but better to use

 Sequence seq = GetSequenceByName ( "MainSequence")

 

then to get you value from your local

 PropertyObject str = seq.Locals.GetValString("strTextBox", 0);

 

Because you have a reference to Locals for the required sequence you dont use "Locals" in the Lookup String.

 

You only need the full Lookup string if you have the Sequence Context.

 

Hope this helps

 

 

Regards
Ray Farmer
Message 11 of 14
(1,178 Views)

Thanks a lot! It works!

0 Kudos
Message 12 of 14
(1,175 Views)

One more thing. When  i change local variable i see the change in the code but sequence stays unchanged.

 

 

Engine my_egine = axApplicationMgr.GetEngine();

SequenceFile seq_file = my_egine.GetSequenceFileEx(seq_file_path, TypeConflictHandlerTypes.ConflictHandler_UseGlobalType);

Sequence seq = seq_file.GetSequenceByName("MainSequence");

 

seq.Locals.SetValString("strTextBox", 0, "my new string");
string str = seq.Locals.GetValString("strTextBox", 0);
            
MessageBox.Show(str);

 

I see "my new string" in message box but in the sequense the text is "Hello World".

0 Kudos
Message 13 of 14
(1,173 Views)

Hi John,

 

Answered here

 

 

Regards
Ray Farmer
0 Kudos
Message 14 of 14
(1,148 Views)