NI TestStand Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
RayFarmer

Expand on the default Array Functions

Status: Completed
With the release of TestStand 2012, we added a number of expression functions for manipulating arrays including Sort, FindIndex, FindOffset, Contains, IndexToOffset, OffsetToIndex, and SetElements. We also added the Split and Trim functions for handling strings and the Max and Min expression functions now support arrays. Finally, we added drag-and-drop functionality to the Variables view for arrays so elements can now be interactively inserted, deleted, moved and so on. For more details on any of these features, check the New Features section in the NI TestStand 2012 Help under What's New in TestStand>>TestStand 2012>>New Features. Thanks for your feedback and keep it coming! Lars

Handling arrays in TestStand is pretty limiting and more often that not you have to pop into a code module to perform any sort of array handling.

The following is the default functions that can be used in expressions:

[Array
GetArrayBounds(array, lower, upper) Retrieves the upper and lower bounds of an array.
GetNumElements(array) Returns the number of elements in an array.
InsertElements(array, index, numElements) Inserts new elements into a one-dimensional array.
RemoveElements(array, index, numElements) Removes elements from a one-dimensional array.
SetArrayBounds(array, lower, upper) Changes the bounds of an array.
SetNumElements(array, numElements) Sets the number of elements in a one-dimensional array.

]

 

 

I would like to see this expanded to avoided have to resort to using code module.
The following is some suggestion:


Array Subset function
Array Max & Min
Replace Array Subset function
Search 1D Array
Sort 1D Array

 

 

regards

Ray Farmer

Regards
Ray Farmer
13 Comments
crelf
Trusted Enthusiast
I wish I could kudos this idea more than once 🙂




Copyright © 2004-2024 Christopher G. Relf. Some Rights Reserved. This posting is licensed under a Creative Commons Attribution 4.0 License.
PhillipBrooks
Active Participant

Kudo'ed!

 

When all you use with TestStand is LabVIEW, array manipulation like this can become memory and CPU intensive 😞


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

Sergey_Kolbunov
Member
I would expand default functions with handling arrays of more than 1D size. Say, GetNumElements() works just for 1D arrays, but I need it for 2D arrays often.
RayFarmer
Trusted Enthusiast

That is true, try ArrayDimensions.GetDimensionsSizes for multi dimension arrays.

Regards
Ray Farmer
Jervin Justin
NI Employee (retired)
Status changed to: Under Consideration
 
Jervin Justin
NI TestStand Product Manager
Anjan Karanam
NI Employee (retired)

Hey everyone, as Jervin previously indicated, we're considering this idea.  If you have any more functionality that you would like to see included in TestStand regarding the arrays, please add your comments to this post.  Thanks!

RayFarmer
Trusted Enthusiast

One that has just reappeared on the forum and that is the ability to initialise all the elements of an array with a particular value.

Regards
Ray Farmer
RayFarmer
Trusted Enthusiast

Also include emptying the array (including 2D which doesn't appear possible at the moment).

Regards
Ray Farmer
dug9000
NI Employee (retired)

You can empty multi-dimensional arrays with an expression similar to the following: SetArrayBounds(Locals.Local, "[0][0]", "[][]")

I agree there should be some more straightforward way to do this though, or perhaps the documentation/tooltip for SetNumElements should explain this.

-Doug

RayFarmer
Trusted Enthusiast

Thanks for that Dug.

Regards
Ray Farmer