12-28-2009 07:29 AM
Hi all,
How to empty 2D array in TestStand? I have a test setup sequence with several 1D and 2D arrays as local variables. At the end of this sequence the user can choose an option to rerun setup. In this case I want to empty all arrays, because not all of them are mandatory and may stay empty, according to user definitions. For emptying 1D array I'm using DeleteElements method.There are remarks in help:"This method is only valid for one-dimensional array objects. Use the PropertyObjectType.ArrayDimensions property to change the size of multi-dimensional array objects".
But PropertyObjectType.ArrayDimensions is read-only.
Thanks in advance.Solved! Go to Solution.
12-29-2009 07:03 AM
Hi,
Maybe you can define the new array bounds to empty the array : SetArrayBounds(Locals.My2DArray, "[0][0]", "[][]")
The result should be : My2DArray[0..empty][0..empty]
Bruno
12-29-2009 07:52 AM
Hi Bruno,
I tried the similar option:
Locals.Array2D.Type.ArrayDimensions.SetBoundsByStrings("[0][0]","[0][0]")
But it did not work properly: the element [0][0] was not deleted.
12-29-2009 05:38 PM
Hi Berezka,
To delete the last element you can then call DeleteElements:
Locals.Array.Type.ArrayDimensions.SetBoundsByStrings("[0]","[0]")
Locals.Array.DeleteElements(0,1,0)
You can then later resize the array to the proper dimensions when you are ready to use it again. I will look to see if there are any other options.
12-30-2009 06:39 AM
Hi,
SetBoundsByStrings("[0][0]","[0][0]") => 1 element : Locals.Array2D, Array of Type [0..0][0..0]
BUT
SetBoundsByStrings("[0][0]","[][]") => no element : Locals.Array2D, Array of Type [0..empty][0..empty]
The upper bounds must be set without any number.
Bruno
12-30-2009 08:36 AM
11-14-2019 08:07 AM
Would this not also work?
Locals.Array2D = {}