NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Inserting in the UUT_Results table a value that we read from our data base from a local variable

We would like to include in the UUT_Results table a value that we read from our data base into a local variable during the execution of our sequence file. We found that by modifying the configure database options we were able to add a column for this variable, but the local variable was not available to be placed into an expression for that column from the local variables or parameters. Is it possible to do this, and if so, how? Station Globals were available to be included in the expression, however the sequence file may be executed on more than one system which makes the Global unavailable on systems other than the one where the sequence file originated.
0 Kudos
Message 1 of 5
(3,493 Views)
You can use the TestStand API to programmatically create global variables at runtime, thus ensuring their existence. For example, you could call Engine.Globals.SetValString("GlobalStringVariableName", PropOption_InsertIfMissing, "variable value")

Of course, if you need to test multiple UUTs in parallel, a single global is not sufficient. In that case you might consider adding the field you need to the UUT datatype in the process model. You could then access the field in your sequence via RunState.Root.Locals.UUT.YourNewField = YourNewValue.

If you also want your sequence to run without using a process model, you must check for the existence of the UUT before accessing it. You could use the expression function: PropertyExists("RunState.Root.Locals.UUT.YourNewFi
eld")
0 Kudos
Message 2 of 5
(3,493 Views)
James explained how to share data easily within TestStand.

As far as using the Database Logging feature, it is intended to be output only. There is little to no support in the tool for importing data from the database to TestStand variables.

Scott Richardson (NI)
Scott Richardson
https://testeract.com
0 Kudos
Message 3 of 5
(3,493 Views)
Scott is correct in pointing out that the database logger is for output only.

However, it is worth noting that the TestStand database step types make it easy to read values from a database into variables at runtime. The database logger can then log these values into the UUT table, provided you read the values into station globals or UUT fields.
0 Kudos
Message 4 of 5
(3,493 Views)
I agree with James about adding a field to the Locals.UUT variable in your process model. This variable will show up as Logging.UUT.YourNewField when you configure database logging to add the new column. An alternative to adding the field at runtime is to modify the custom data type 'UUT' in the sequence file types of your process model.
0 Kudos
Message 5 of 5
(3,493 Views)