NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Clearing a fileglobal array of strings

Solved!
Go to solution

I have a fileglobal 2 dimensional array of strings. How does one clear it each time the sequence is called, use a for loop? It used to not be a problem but now it seems to have old data in it all the time.

 

thanx,

 

jvh

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

I don't know if there's a native TS method to empty/reset a 2D array, but much of our code (going back to TS 1.0!) simply uses the "TestStand - Set Property Value (2D String Array).vi" and a sequence context ref to reset a FileGlobals.

 

It has worked for us for 10+years...

0 Kudos
Message 2 of 4
(3,617 Views)
Solution
Accepted by topic author jvh75021

You can do this from an expression:

 

GetArrayBounds(Locals.Array, Locals.OriginalLowerBounds, Locals.OriginalUpperBounds),
SetArrayBounds(Locals.Array, "[0]", "[]"), // Make the array empty in order to clear it.
SetArrayBounds(Locals.Array, Locals.OriginalLowerBounds, Locals.OriginalUpperBounds) // Restore array back to its original size

 

Hope this helps,

-Doug

Message 3 of 4
(3,605 Views)

Thanks.

 

Wished there was a one liner..

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