NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Use the data typ "array of container" in teststand

Solved!
Go to solution

Hi,

I have a problem by using the data typ "array of container" in the TestStand.

 

I have defined a empty local variable as "array of container" with a name "array_of_container1", and also a local variable as "container" with a name "container1".

 

The Problem is, I cant insert the container1 into the array array_of_container1.

 

At the end, I want to get a array with x container elements

array_of_container1[0].container1,

array_of_container1[1].container1,

....

array_of_container1[x].container1

 

 

thanks a lot!

Cabio

Message 1 of 12
(8,901 Views)

nobody knew that?Smiley Surprised

0 Kudos
Message 2 of 12
(8,887 Views)

You cannot simply put an existing variable into an array. You have to define the container directly as element of the array.

 

Norbert

 

EDIT: You can copy the container into the array, sure, but still the container remains as "original"

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 3 of 12
(8,880 Views)

Hi,

 

which version of Teststand are you using?

Just copy and past the container1

Array.png

0 Kudos
Message 4 of 12
(8,874 Views)

Thanks Norbert_B,

I have tried it. But not work with dynamic array!

 

container define:

container1

 

array define:

array_of_container

[0] container1

[1] container1

[2] . (no define)

 

Result:

"array_of_container[0].container1 = container1", it works!

"array_of_container[1].container1 = container1", OK!

"array_of_container[2].container1 = container1", Error!

 

So the user must define all the elements in the array, and then it will be working, but the problem is, the total elements number is not fix, is dynamic.

0 Kudos
Message 5 of 12
(8,873 Views)

Thanks again!

I am using TestStand 2010 SP1.

0 Kudos
Message 6 of 12
(8,872 Views)

 

Hi,

you mean dynamic array sizing. During execution in an expression, you can resize an array . Use the SetNumElements expression functions to modify the upper and lower bounds for a one-dimensional array.

 


I hope this will help

0 Kudos
Message 7 of 12
(8,859 Views)

Thanks hsm78.

It is not so easy.

Besauce you can increase the index, but you must specify the typ of the new elements in the array as container1.

 

Only increase the index does not work. Smiley Sad

0 Kudos
Message 8 of 12
(8,854 Views)

Hi

 

this demonstrates how elements can be added to an empty 1D

 

Adding Elements to Empty Arrays in TestStand

0 Kudos
Message 9 of 12
(8,842 Views)

Thanks hsm78,

I think, you have not understood where is my problem.

 

I can do change the index and add new elements in a array.

 

But I cant set the type of the new elements as "container1". I mean programmable.

 

When you know, how many elements in the array before the start of the programm, you could do it manually. Norbert_B has showed this method in his pictures.

 

I think maybe the property "ArrayElementPrototype" is the right way, but I dont know, how to use it. I am trying.

0 Kudos
Message 10 of 12
(8,836 Views)