NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

find and replace using recursive search in teststand

In the process model, once the MainSequence callback is finished, the variable Locals.ResultList[0].TS.SequenceCall.ResultList contains all the results i need. What i need to do is search for a specific text ("Version") in ReportText variable for all the step results including sub-sequence results and replace it with say "12345".

Is there any Teststand API that can do a recursive search and replace? 

 

 

0 Kudos
Message 1 of 3
(5,262 Views)

In the help file, the first result for searching for "search" is the PropertyObject.Search() method:

 


PropertyObject.Search

Search Method

Syntax

PropertyObject.Search ( lookupString, searchString, searchOptions, filterOptions, elementsToSearch, limitToAdapters, limitToNamedProps, limitToPropsOfNamedTypes, subpropLookupStringsToExclude)

Return Value

SearchResults

A SearchResult object.

Purpose

Searches a property object and its subproperties.

Remarks

Returns a SearchResults object that is a handle to the asynchronous search already in progress. To wait for the search to complete, call the SearchResults.IsComplete method.

Parameters

lookupString As String

[In] Pass a lookup string indicating the location of the subproperty of the PropertyObject on which to begin the search. If a match is found, the location of the match in the SearchMatch object is relative to the original PropertyObject, not the subproperty. You can pass an empty string for this parameter to begin the search at the root-level of the PropertyObject.

searchString As String

[In] Pass the string or regular expression for which to search. In order to use regular expressions, you must pass the option SearchOptions_RegExpr for the searchOptions parameter of this method.

searchOptions As Long

[In] Pass one or more SearchOptions constants. Use the bitwise-OR operator to specify multiple search options. The search option SearchOptions_IncludeSubsequenceFiles does not apply to this method.

filterOptions As Long

[In] Pass one or more SearchFilterOptions constants. Use the bitwise-OR operator to specify multiple search filter options. Only the following filter options apply to this method: SearchFilterOptions_CustomStepProps, SearchFilterOptions_BuiltinStepProps, and SearchFilterOptions_ModuleStepProps.

elementsToSearch As Long

[In] Pass one or more SearchElements constants. Use the bitwise-OR operator to specify multiple elements to search.

limitToAdapters As String Array

[In] Pass an array of AdapterKeyNames constants to indicate the steps of which adapters to search. Pass an empty array or NULL to search steps that use any adapter.

limitToNamedProps As String Array

[In] Pass an array of property names under which to limit the search. Pass an empty array or NULL to search all properties. If you specify names of properties to which to limit the search, TestStand searches only those properties with the names you specify and all of their subproperties.

limitToPropsOfNamedTypes As String Array

[In] Pass an array of type names to which to limit the search. Pass an empty array or NULL to search instances of all types. Use this parameter to limit the search instances of all types. Use this parameter to limit the search to instances of the types you specify.

subpropLookupStringsToExclude As String Array

[In] Pass an array of lookup strings that indicate which subproperties to exclude from the search. Pass an empty array or NULL if you do not want to exclude any properties. You can pass a lookup string with the wildcard character (*) in place of any property name to indicate that all properties match that part of the lookup string. You can also use the wildcard character to match any element of an array by specifying the wildcard character (*) for the array element index. For example, if the property object you search is an array of steps, you can specify the lookup string "[*].Result" to exclude the Result property of all steps in the array.

Note  When you exclude a subproperty, you also exclude all of the subproperties the subproperty contains.


This was pulled from the TestStand 4.2.0 help file.

 

Message 2 of 3
(5,242 Views)

Thanks Asbo.

 

BY the way, i managed to find an example sequence posted by Ray Farmer in this thread http://forums.ni.com/ni/board/message?board.id=330&thread.id=12493&view=by_date_ascending&page=1

 

I modified to my requirement, and i am posting it here.

 

Thanks everyone.

0 Kudos
Message 3 of 3
(5,212 Views)