NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I dynamically create a parameter name and use it?

Hi,

 

I'd like to put my IO list in 2 container parameters Nest1 and Nest2. How can I create that name dynamically using RunState.TestSockets.MyIndex and how to use it?

It would look like this

RunState.Sequence.Parameters.{Dynamically created name}.Output1

 

I tried several methods and all I get is "found container instead of string" error.

 

Nest1

   Output1   "DIO96/port0/line1"

   Output2   "DIO96/port0/line1"  etc.

 

Or is there a better way to do it.

 

Thanks

J,

0 Kudos
Message 1 of 4
(3,503 Views)

If you set your Sequence Parameter to have a Container <DIOList> (no elements) statically

so that you can create a local container with Nest1 and Nest2 and passing Locals.<container_name>

and at runtime Parameters.DIOList.Nest1 and Nest2 will be available in the Sequence

 

 

 

Regards
Ray Farmer
0 Kudos
Message 2 of 4
(3,499 Views)

Hi Ray,

 

Thanks for your response. I do not understand the explanation. Maybe it is because I did not explain what I need or maybe becasue I am new to TS. Here's what I'd like to do.

Have a predefined list of IO names. Like:

Nest1 

K23    "DIO96/port0/line1"

K24    "DIO96/port0/line2"

 

Nest2

K23    "DIO96/port1/line1"

K24    "DIO96/port1/line2"

 

I will have 2 nests(sockets) in my system running batch model. From what I understand I can have 1 sequence defined and TS that will execute 2 threads with 1 socket per thread. In this sequence I somehow need to pass to my VI the value of K23 which is different for socket1 and 2. I was thinking that I can somehow create the Property Name Dynamically. Sort of like that:

RunState.Sequence.Parameters.GetPropertyObject("Nest%d",RunState.TestSockets.MyIndex+1).K23

 

It would give the sequence running for socket 1 the value "DIO96/port0/line1" and "DIO96/port1/line1" for socket 2

 

thanks

J.

 

0 Kudos
Message 3 of 4
(3,479 Views)

I think I got it. My expression look like this:

 

RunState.Sequence.Parameters.DIOList[ RunState.TestSockets.MyIndex ].Output1

 

Thanks for help

J.

0 Kudos
Message 4 of 4
(3,474 Views)