11-24-2017 06:31 AM
Hi All,
I am new to TestStand, I have used the write method to write values in my local variable (Locals.Parameters) to a text file address specified in my local variable (Locals.FilePath):
Locals.Parameters.Write (Locals.FilePath, "MY_GLOBALS", 0)
I have set the RWoptions = 0 (indicating default behaviour).
I now want to write more than one variable (Locals.Parameters and Locals.Parameters2) to my text file which Locals.FilePath points to. I tried setting RWoptions = OR (bitwise-OR as described in TestStand help:
Locals.Parameters.Write + Locals.Parameters2.Write (Locals.FilePath, "MY_GLOBALS", OR)
This doesn't work so I tried to individually write them but this only writes the last variable (Locals.Parameters2):
Locals.Parameters.Write (Locals.FilePath, "MY_GLOBALS", 0),
Locals.Parameters2.Write (Locals.FilePath, "MY_GLOBALS", 0)
Is it possible to write multiple variables to a text file and could you please enlighten me on how to implement this in TestStand code? (BTW I am using TS 2014)
Any help is much appreciated, thanks
Solved! Go to Solution.
11-27-2017 05:42 AM
What I am trying to do here is use multiple text files with parameter settings defining different modes of parameter settings to run in my code. My code will have the following structure:
- Step1: Select text file.vi
- Expression1: Read Parameters from file & update variables
-Step2: Load parameters (parameters set from variables)
-Expression2: Write updates to parameters(if parameters updated) to text file
Expression1: Locals.ReadEx (Locals.FilePathLabview, "Locals",0)
and
Expression2: Locals.Write (Locals.FilePathLabview, "Locals",0)
is doing what I require but I am selecting all my local variables. I want to only read and write to a selected number of local variables only.
11-27-2017 11:08 AM
Hey Sean,
Would you be able to provide a file showing what you have done already?
11-28-2017 09:55 AM
Thanks for your reply. I came up with a simple solution to my problem. I simply added another layer of hierarchy. In the types pane I created a custom data type to combine all the data that I wanted to read/write to my text file. Then this allowed me to use the API write method:
Locals.Custom_Data_Type_Name.ReadEx (pathString, objectName, RWoptions)
and
Locals.Custom_Data_Type_Name.Write (pathString, objectName, RWoptions)