12-19-2013 03:28 AM - edited 12-19-2013 03:35 AM
Hey guys,
I just started to use TestStand and I have got the following question:
I have 2 fileglobals:
FileGlobals.Limit1 and FileGlobals.Limit2
The User will define the fileglobals in an INI File and the names and values from the files will first be stored in 2 Arrays.
Array of string: FileGlobals.ArrayNames (Element 0 is "Limit1" and Element 1 is "Limit2")
Array of number: FileGlobals.ArrayValue (Element 0 contains value of "Limit1" and Element 1 contains value of "Limit2")
In one step I check if the name in the array is a fileglobals: In other words: Does FileGlobals.Limit1 and FileGlobals.Limit2 really exist.
PropertyExists("FileGlobals.ArrayNames[0]") and PropertyExists("FileGlobals.ArrayNames[1]")
Now I know that the Globals exist. the next step is saving the values of the Array (FileGlobals.ArrayValue) in the FileGlobals Limit1 and Limit2.
Is there a possibility to avoid the following:
Fileglobals.Limit1 = FileGlobals.ArrayValue[0]
I would like to use something like this:
FileGlobals."FileGlobals.ArrayNames[0]" = FileGlobals.ArrayValue[0]
I know that the Fileglobal really exists and I know the name of it. This would make later changes in variable names more easier in this case...
I hope you know what I mean and you can help me.
Thanks a lot!
Walter
12-19-2013 05:30 AM
12-20-2013 11:56 AM
You can also use the Evaluate() function to get the reference of your variable.
This function is a little bit magic because if write some thing like this : "Evaluate(FileGlobals.ArrayNames[0]) = FileGlobals.ArrayValue[0]" it will directly write ArrayValue[0] into the variable described by FileGlobals.ArrayNames[0].
To have this working you just have to ensure that 'FileGlobals.ArrayNames[0]' contains the whole variable name (lookup string): for example "Locals.MyValue" is correct ; "MyValue" alone is not !
12-23-2013 04:59 AM
Hello Juergen,
thanks for your answer.
Could you save the example for TestStand 2010?
Thanks,
Walter
12-23-2013 02:09 PM