04-02-2013 08:04 AM
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
Solved! Go to Solution.
04-03-2013 02:11 AM
nobody knew that?
04-03-2013 05:43 AM - edited 04-03-2013 05:44 AM
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"
04-03-2013 06:11 AM
Hi,
which version of Teststand are you using?
Just copy and past the container1
04-03-2013 06:19 AM
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.
04-03-2013 06:20 AM
Thanks again!
I am using TestStand 2010 SP1.
04-03-2013 06:47 AM
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
04-03-2013 07:03 AM
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.
04-03-2013 09:06 AM
Hi
this demonstrates how elements can be added to an empty 1D
04-03-2013 09:27 AM
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.