NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

parse a result string into an array of tokens

I am working on this project that, for one test step returns one long string in the result container, and I need to parse this string by a deliminator into unknown number of tokens so that it can be recorded individually.  I have couple ideas in my mind, but I am not sure if this is the best way.

 

One idea, I am thinking to use "C Struct" for the function parameter in the test step.   The function that this test step would call parses the string and outputs to the "C Struct".  The dynamic array size would be allocated in the function, and this C Struct class is a wrapper around that array.  For example:

 

TokenList:container

   NumberOfToken:number

   Token[]:array of string                <==initially empty

 

output will be

 

TokenList:container

   NumberOfToken:number

   Token[0..3]:array of string          <==after parse, four token are store in the Token array.

 

 

Second idea is to customize the step type by using the post-step calling a CVI function that would parse the string and stick into "Result" container (can I pass in "Result" container and modify this container in a CVI function?)

 

Thank you.

 

Peggy

 

0 Kudos
Message 1 of 3
(3,670 Views)

Just reply to my own post as an update.  It is able to parse the result string into arrays of tokens by using common adapter class.  But I realize the database recording is by sub-properties, step, and then UUT only.  The original thought of using array to have multiple records in the database does not work.

0 Kudos
Message 2 of 3
(3,634 Views)
You could use the string functions such as mid() to parse the string once inside of teststand. Otherwise you could return an array of strings and in TestStand initalize the array to be larger than your potentiall return value.
Richard S -- National Instruments -- (former) Applications Engineer -- Data Acquisition with TestStand
0 Kudos
Message 3 of 3
(3,616 Views)