Chris -
Unfortunately TestStand does not allow you to specify an arbitrary expression for a column that is designated as a primary key. Because of this limitation, the database logging feature cannot keep track of the value that was specified for a primary key and use it later when a table uses it as a foreign key. So this means that to write out key values, you need to keep track of them yourself in some way. In addition you would most likely not be able to use the STEP_PARENT column in a table. Below is a possible way of logging to a database as you asked.
Basic Requirement:
You need a way to guarentee that the primary key value that is generated by each computer for a single table that holds either UUT or step information does not conflict. In addition, the values that are generated by a single computer must increment without overlap.
Example:
You could use a unique base value for each computer and use an incrementing value per computer to make the key values for each level of table.
On each station, you could create the following station global values:
StationGlobals.ComputerBaseValue = xx0000000
StationGlobals.ComputerUUTKeyValue = 0
StationGlobals.ComputerStepKeyValue = 0
StationGlobals.ComputerOtherKeyValue = 0
Of course you would have to alter the database tables to use integer values for their key values.
For each primary and foreign key column defined in the Generic Insert schema, you would have to turn off the primary key and foreign key checkboxes, change the data type from GUID to Integer, and then use the following expressions to generate the key values:
UUT_RESULT
ID: "++StationGlobals.ComputerUUTKeyValue + StationGlobals.ComputerBaseValue"
STEP_RESULT
ID: "++StationGlobals.ComputerStepKeyValue + StationGlobals.ComputerBaseValue"
UUT_RESULT: "StationGlobals.ComputerUUTKeyValue + StationGlobals.ComputerBaseValue
STEP_PARENT: (You must delete this column from the schema and remove from the INSERT statement in the schema)
STEP_PASSFAIL:
ID: "++StationGlobals.ComputerOtherKeyValue + StationGlobals.ComputerBaseValue"
STEP_RESULT: "StationGlobals.ComputerStepKeyValue + StationGlobals.ComputerBaseValue
So the key values would look something like this:
xx0000000
xx0000001
xx0000002
xx0000...
Note that when using this methodology you should only log one UUT at a time on a single computer. If you must run parallel executions you should use a mutex to prevent two executions on a single computer from logging at once.
Note that if the TestStand process exits without saving the station globals file, the next execution that logs to the database might reuse key values. Depending on your constrainst this might error. You might have to manually fix the station global values when this happens.
Scott Richardson
Scott Richardson
https://testeract.com