NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Access to locals in the sequence

Solved!
Go to solution

Hi All

I need to get access to locals in my sequence file from C# in order to udate it.

How can i do it. Is there any example?

Regards.

0 Kudos
Message 1 of 14
(4,574 Views)

checkout the Computer Motherboard example in the TestStand examples folder under \Demo\.NET.

Regards
Ray Farmer
0 Kudos
Message 2 of 14
(4,574 Views)

Thanks Ray , nice example but i fail to see some locals access.

0 Kudos
Message 3 of 14
(4,570 Views)

The code modules for this example returns a boolean which is feed into the Step.Result.PassFail. Also the Error values are passed into the individual elements of Step.Result.Error.

 

But these code modules could have passed the data into a local variable rather than a Step property.

 

Similarly, data could be passed into the code module this way if the parameter of the code module was defined as an input rather than an output.

 

Hope this helps. I'll see if there is a better example.

Regards
Ray Farmer
0 Kudos
Message 4 of 14
(4,565 Views)

After reading Test Stand help i understand that i can get access to locals with SequenceContext object.

How can i initialize it? Should i pass my *.seq file as a parameter? In general i understand but in details it's quite obscure.

0 Kudos
Message 5 of 14
(4,555 Views)

John,

 

there is an example from juergen in

http://forums.ni.com/t5/NI-TestStand/how-can-I-disply-multiple-window-based-on-previous-window-value...

that may help.

 

 

Regards
Ray Farmer
Message 6 of 14
(4,550 Views)

Thank you Ray i'll try.

0 Kudos
Message 7 of 14
(4,548 Views)

After some studying i came with code:

 

s

string str;
string seq_file_path = Path.GetDirectoryName(Application.ExecutablePath) + "\\Demo.seq";


private void buttonExecute_Click(object sender, EventArgs e)
        {
            Engine my_egine = new Engine();
            SequenceFile seq_file = my_egine.GetSequenceFileEx(seq_file_path, 0,           TypeConflictHandlerTypes.ConflictHandler_UseGlobalType);
            SequenceContext seq_cont = seq_file.NewEditContext(); 
            PropertyObject prop_obj = seq_cont.AsPropertyObject();
            str = prop_obj.GetValString("Locals.strTextBox", 0);
            MessageBox.Show(str);
        }

 I get an exeption:

Unknown variable or property name 'Locals'.
Error accessing item 'Locals.strTextBox'.

What do i wrong?

0 Kudos
Message 8 of 14
(4,523 Views)

Hi John,

 

You need to get a reference to a Sequence within the SequenceFile to see the Locals.

At SequenceFile level you can see any FileGlobals.

 

Hope this helps

 

Regards
Ray Farmer
0 Kudos
Message 9 of 14
(4,521 Views)

Hi Ray,

How i get a reference to a Sequence within the SequenceFile ?

Could you explain it by example?

0 Kudos
Message 10 of 14
(4,519 Views)