ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom DB Schema - Foreign Key Lookup

Hi,

 

I have a custom database schema and I am trying to configure TestStand to use it for logging data.

 

In my main test execution table, I have a number of foreign key fields:

Operator_ID

Test_Type_ID 

etc.

which look up the Operator and Test Type from their respective tables.

 

How can I populate these ID values from the Database Options schema?

 

I tried:

1) Using a sub-query in the but it then complains about the data types :

"INSERT INTO Test_Execution (
ID,
Serial,
Product_Code,
PPS,
Test_Type_ID,
Start_Time,
Execution_Time,
Operator_ID,
Station_Name,
Test_Version,
Status,
Result,
Error_Code,
Error_Message
) VALUES (?,?,?,?,(SELECT ID FROM Test_Type WHERE Name = ?),?,?,?,?,?,?,?,?,?)"

 

2) I also tried adding additional SQL statements before the Test_Execution statement but I couldn't get it to work and return the ID value to use in the Test_Execution statement (as a foreign key):2017-10-03_17-28-36.png

2017-10-03_17-29-33.png

 

The error message is as follows:

2017-10-03_17-30-42.png

 

Any ideas?


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 1 of 1
(2,523 Views)