NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Logging UUT.AdditionalData to the database

Solved!
Go to solution

As part of the design we're considering, is there any way I can dynamically load data into the database?

 

The UUT container has AdditionalData container that's PropFlags_UnstructuredProperty. Thus it allows easy access to add new data into for testing purposes. It's been requested that the test developer can put additonal data into this so that it shows up in the results/reports. Best Practices for NI TestStand Report Generation and Customization explains how to add values to this container well under "Logging additional UUT and Station data to the report header (TestStand 2013 and later only)".  My question is, I want this data to be available to be put into the database, not just in the report:

 

Parameters.UUT.AdditionalData.SetValString("Manufacturer.Name",1,"National Instruments"),

Parameters.UUT.AdditionalData.SetValString("Manufacturer.Location",1,"Debrecen, Hungary"),

Parameters.UUT.AdditionalData.SetFlags("",0,PropFlags_IncludeInReport)

 

So if a person does this, I'd like to be able to store all these in the databse. I've created a new table based off UUT Result that has 4 columns, ID, TestResultID, Name, Value that should be enough to meet this requirement.  Each property in AdditionalData will be an entry to this other table with the TestResultID being a Foreign Key to the  UUT_Result table.

 

How can I get the database plugin to loop over data, or do I have to handwrite this feature into my process model?

Certified-LabVIEW-Architect_rgb.jpgCertified_TestStand_Architect_rgb.jpg


"I won't be wronged. I won't be insulted. I won't be laid a-hand on. I don't do these things to other people, and I require the same from them." John Bernard Books

0 Kudos
Message 1 of 5
(6,909 Views)

Hi,

 

You can try below steps if the number of properties in AdditionalData container is fixed and if you are OK to customize your schema.

1. Override PreUUT callback and add a statement step to dynamically add a property in the Parameters.UUT.AdditionalData container.
For example,
Parameters.UUT.AdditionalData.SetValString("Data1",1,"National Instruments"),
Parameters.UUT.AdditionalData.SetValString("Data2",1,"Debrecen, Hungary")
2. Launch Database Options Dialog in TestStand Sequence Editor from Configure->Result Processing->Database Options
3. Create a copy of the schema you are using
4. Create a new statement. Add a column for each property in the AdditionalData container, add a column for primary key ID and add a column UUT_RESULT which is the foreign key to UUT_RESULT table
For example, if you have Data1 and Data2 properties in AdditionalData container, create 2 columns Data1 and Data2
5. In Value To Log field (In TestStand 2014) or Expression field (TestStand 2013 or earlier), add Logging.UUT.AdditionalData.Data1 for Data1 column and Logging.UUT.AdditionalData.Data2 for Data2 column. Make sure to set the column type to appropriate data type.
6. Refer to the attached snapshot for the statement settings

 

To create a table using Database Options dialog,

1. Select schema and click on Validate to create a table for the newly created statement
2. In Schema Validation Dialog, click on "Generate SQL" button
3. In Database Viewer, execute the query to create a table

 


With these settings, executing a sequence should log fields in AdditionalData to the database.

 

Regards,

Sahana

0 Kudos
Message 2 of 5
(6,889 Views)

That option will not work too well, as I don't know all the possible elements my co-workers will want to store.

 

For example Tester 1 will want to store data "A", "B", "C". Tester 2 will want to store data "B", "D", "E", "F", "G". Tester 3 will want to store data "H", "J".

 

 

While in this example I list 9 things, it's possible to be a dozen items for each tester, and dozens/hundreds of tests. So much that we want it to be dynamic. Thus why it's a Name/Value database table and want a way to loop through all values in that container.

 

 

So that, when all said in done, each test's PreUUT looks as simple as:

 

Test 1:

Parameters.UUT.AdditionalData.SetValString("A",1,"Data"),

Parameters.UUT.AdditionalData.SetValString("B",1,"Data"),

Parameters.UUT.AdditionalData.SetValString("C",1,"Data"),

Parameters.UUT.AdditionalData.SetFlags("",0,PropFlags_IncludeInReport)

 

 

Test 2:

Parameters.UUT.AdditionalData.SetValString("B",1,"Data"),

Parameters.UUT.AdditionalData.SetValString("D",1,"Data"),

Parameters.UUT.AdditionalData.SetValString("E",1,"Data"),

Parameters.UUT.AdditionalData.SetValString("F",1,"Data"),

Parameters.UUT.AdditionalData.SetValString("G",1,"Data"),

Parameters.UUT.AdditionalData.SetFlags("",0,PropFlags_IncludeInReport)

 

 

Test 3:

Parameters.UUT.AdditionalData.SetValString("H",1,"Data"),

Parameters.UUT.AdditionalData.SetValString("J",1,"Data"),

Parameters.UUT.AdditionalData.SetFlags("",0,PropFlags_IncludeInReport)

 

 

 

 

 

 

Certified-LabVIEW-Architect_rgb.jpgCertified_TestStand_Architect_rgb.jpg


"I won't be wronged. I won't be insulted. I won't be laid a-hand on. I don't do these things to other people, and I require the same from them." John Bernard Books

0 Kudos
Message 3 of 5
(6,876 Views)
Solution
Accepted by topic author bsvare

 

You can log UUT.AdditionalData properties as result properties of a step in a new table.

 

1. Add a new Table that is constrained to the UUT key. Refer to UUT_PROP_RESULT_ADDITIONAL_DATA statement in "Test Log UUT Additional Results - Generic Recordset" schema in the attached schema file.
2. Add steps to create UUT.AdditionalData properties , and then have a step that takes the UUT.AdditionalData, clones it and adds it as a result property of a step called UUTAdditionalData. (sample sequence file attached)

3. Then create a schema that will log the additional data container when found as a step result when its property path contains UUTAdditionalData property name. Note the precondition on the UUT_PROP_RESULT_ADDITIONAL_DATA statement and that the Traversing options stops the processing of a result once if the UUT_PROP_RESULT_ADDITIONAL_DATA table processes the property (so it will not also be logged to the PROP_RESULT table). Schema file(TestStandDatabaseSchemas.ini) is attached. You can directly import the schemas from the schema file in Database Options Dialog to log.

 

Hope this works.

 

Regards,

Sahana

 

 

Message 4 of 5
(6,807 Views)

Hi,

 

Attaching the MDB file which contains the tables for the "Test Log UUT Additional Results - Generic Recordset" schema mentioned in my last post.

 

Regards,

Sahana

0 Kudos
Message 5 of 5
(6,800 Views)