From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Using the property loader to load strings into an array

Hi,

I would like to use the property loader to load several strings from a text file. These strings will then be put into an array. I have found a partial solution to this, but it requires the array element to be used. For example:-

Text File

START

<Step Name>

<Locals>

arrayString[0]    "Element 1"

arrayString[1]    "Element 2"

END

 

Property Loader

Selected:

Locals.arrayString[0]

Locals.arrayString[1]

This is not very flexible as every time a new string is added to the text file, the array size needs to be redimensioned and the property loader needs a new entry.

Is there a way of not having to specify the array element in the property loader and having the array re-size itself based on the data loaded into it? ( I tried the below code and it does not work, is there something similar I can do? )

 

Text File

START

<Step Name>

<Locals>

arrayString "Element 1" "Element 2" "Element 3"

END

 

Property Loader

Selected:

Locals.arrayString

Thanks

Kevin

0 Kudos
Message 1 of 4
(4,211 Views)

Hi Kevin,

Try this example from Antonio http://forums.ni.com/ni/board/message?board.id=330&message.id=8043&requireLogin=False

I think this facility was added at TestStand 3.5.

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 2 of 4
(4,210 Views)

Hi Ray,

That's exactly what I needed to know.

Thanks

Kevin

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

What I did is to define the array as a string on the Properties TXT file:

TestSeq.SoakTimeTXT "{\"20\",\"20\",\"0\",\"20\",\"0\"}"

and then at the post expression of the property loader step put this text into array format with the syntax below:

FileGlobals.TestSeq.SoakTimeArray = Evaluate(FileGlobals.TestSeq.SoakTimeTXT),

After this the variable FileGlobals.TestSeq.SoakTimeArray = {20,20,0,20,0}

I think this is a good option for small 1D arrays.

0 Kudos
Message 4 of 4
(2,512 Views)