NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Delete multiple StationGlobals using DeleteSubProperty

I am using DeleteSubProperty to delete StationGlobals in Teststand. In my requirement I need to delete more than one StationGlobals starting with same name e.g I want to delete all StationGloabls starting with name "a". Is it possible using DeleteSubProperty using it only once? I am using TestStand Ver 3.5
0 Kudos
Message 1 of 6
(3,600 Views)

Hi,

Simple answer - No.

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 2 of 6
(3,598 Views)
So is it possible to delete only one stationglobals but using wild character?
e.g If I need to delete stationglobals named "a1". Can I use it like delete "a*.*" or something like this.
Actually in my requirement I am not sure what is the name of stationglobals. I only know the initial name of the stationglobals.
I need to delete it.
0 Kudos
Message 3 of 6
(3,587 Views)

One possible way to do this will be to use the PropertyObject.Search() method.

If you run this method on the StationGlobals property object, you can use SearchOptions_RegExpr to specify that your search string is a regular expression.  Regular expressions can match multiple values.  TestStand will then return a SearchResults object that is a collection of all of the matching PropertyObjects.  Once you have an individual SearchMatch, you can use the GetPropertyPath method to get the lookup string to the property.  Then you will need to call DeleteSubProperty on the original StationGlobals property object and pass it the lookup string that was returned.

Please note that I found all of this information by looking through the TestStand help and have not tested it, so I may have left out a step or two somewhere.

Josh W.
Certified TestStand Architect
Formerly blue
0 Kudos
Message 4 of 6
(3,581 Views)

Hi,

Just to add what Josh has said.

The SearchMatch.GetPropertyLocation(True) will probably return only a relative location from where you took the search property.

ie if you took StationGlobals as the start, and you where searching for occurrances of "administrator" then you would probably get two hits and the first would be at "TS.LastUserName" which is the returned string from GetPropertyLocation.

Also the PropertyObject.Search(...) has a number of parameters which are arrays, these can be empty or NULL. The only way I have made this work is by using a Locals array which is empty.

You can get the number of hits on your search by using SearchResult.NumMatches. You dont have to wait for the search to complete to call this so you could put this in a loop and check for IsComplete to be true.

Hope this helps

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 5 of 6
(3,573 Views)

Hi,

Adding to my last comment.

If you use

PropertyObject.Search("", "^a", 0x4, 0x00FFFFFF, 0x1, Locals.emptyArrayStr,  Locals.emptyArrayStr,  Locals.emptyArrayStr, Locals.emptyArrayStr) you need to setup Locals.emptyArrayStr as an empty String Array. Use StationGlobals as the ActiveX Reference.

This should return back a SearchResult of all the Property Names beginning with "a" within the StationGlobals.

Hope this helps

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 6 of 6
(3,562 Views)