NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Log to database after network reconnect

Solved!
Go to solution

I'm using NI Teststand to run the tests and log the results to the database after the Uut test is finished. Everything works fine until network drops the connection. After that, I get the error from the Teststand, and the execution of testing is interrupted and stopped.

 

An error occurred calling 'LogResults' in 'ITSDBLog' of 'zNI TestStand Database Logging'
Error code: 2147467259

 

The part of the issue that interrupts and stops the test flow I overcome by selecting "Ignore Run-Time Errors" for "Log Results to Database". So the test flow continues with the next Uut but the results for the next Uut's are not logged anymore into the database even when the network connection is back. I found that the database connection reference is opened when the Uut logs the first Uut result and the connection is maintained throughout testing subsequent Uut's - this explains the issue of not logging results after the network reconnects.

If I manually stop the Teststand execution and run it again the "Log to database" works fine again until the next drop in the network connection.

 

I found a similar issue in this post but without the final solution.

 

Is there any solution that could lead to "Get new reference" once when network is back again? Or even better solution to set any property to get always new database connection reference when "Log to Database" is called?

0 Kudos
Message 1 of 2
(735 Views)
Solution
Accepted by topic author MiroslavSavic

I actually find a solution that worked for my case. I found it in that post.

 

Under the sequence "LogToDatabase" sequence "NI_DatabaseLoger.seq" I create a statement after "Log results to Database" and insert Expression:


// Assign the GUID value to our step status for temporary local variable (Evaluate won't work unless this is done for some reason)
Step.Result.status = Parameters.ModelPlugin.Base.GUID,

// Replace all "\s" with "_" in the GUID and build path to datalink object... then set it's value to NOTHING (Destroys DB reference forcing TestStand to re-open it next UUT run.)
Evaluate("RunState.Execution.TSDatabaseLoggingDatalink" + SearchAndReplace(Step.Result.Status,"-","_") + "= Nothing" ),

// Update step status to what it would normally be if we hadn't had to use it as a temporary local variable.
Step.Result.Status = "Done"


This statement forces the Database logger to destroy and re-create a new database connection reference on the next Log to database call.

Message 2 of 2
(597 Views)