12-15-2005 06:01 AM
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
12-15-2005 06:17 AM
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
12-15-2005 07:29 AM
Hi Ray,
That's exactly what I needed to know.
Thanks
Kevin
05-08-2018 02:03 PM
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.