NI TestStand

Showing results for 
Search instead for 
Did you mean: 

Database logging - how to retry/ reconnect after network or server problem (An error occurred calling 'LogResults' in 'ITSDBLog' of 'zNI TestStand Database Logging')

I'm running tests that last around 30 sec / DUT and stores data to a database using a user defined schema. When the (external) SQL DB server  sometimes makes a hick-up / no connection, then teststand reports a runtime error (An error occurred calling 'LogResults' in 'ITSDBLog' of 'zNI TestStand Database Logging'). - see also post"  which describes the same issue



How would I go around setting up teststand to automatically retry the write? Maybe with a dialog to the user where he can press 'retry' or 'stop'. It woul dprobably be something with resetting the reference (RunState.Root.RunState.Execution.TSDatabaseLoggingDatalinkxxxxxxxx) and then calling ITSDBLOG again. Or could the offline results processing do it instead? It doesn't matter if the writing of the data is some minutes delayed.

CLA, Teststand and advanced SQL
0 Kudos
Message 1 of 7

If it's fine to delay the logging then offline results processing is the way to go. This will give you better execution performance since you delay results processing.


If you have to reconnect automatically, the LogToDatabase callback is where you should look at implementing what was mentioned in the forum post you pointed out. One potential way would be to check for an error on the "Log Results to Database" step and handle it by reconnecting and retrying (you could also include a popup like you mentioned).


Generally, I would recommend going with the offline results processing because it's 1. Faster, and 2. Not an internal implementation.



0 Kudos
Message 2 of 7

Thank you very much for the advice on the offline results processing. This looks to be almost perfect for my situation.


A couple of questions:

1)  is it possible for the offline results processing utility to retry processing failed items in inbox? I tried to unplug the network for some minutes - new results generated after the network was plugged in again processes fine - but the results that failed because of the network outage does not retry automatically. I have to manually select "process" on these items in the inbox. This could leave some results for weeks in the inboxes on the different test stations - until someone checks the processing utility and finds them in the inbox.

2) Is it possible to get a status back from the offline results processing utility which I could show on my operator panel - that the utility is runnng and how many items there are in the inbox?

3) Can the TSR filenames be altered in any way? The path is very long and I don't need a lot of the information. Besides, I have chosen to store only one UUT before creating a new TSR offline file - so I would like to have the part and serial numbers in it (the serial numbers are generated while running the test sequence based on things in the UUT)



CLA, Teststand and advanced SQL
0 Kudos
Message 3 of 7

Not sure if this is exactly what you're looking for, but hopefully it's some help:


  1. There are command-line arguments that you could use to write a script that periodically runs the utility.
  2. Using the arguments above, you can generate a logfile that indicates the status, but there are no API methods I'm aware of to easily get this information into an operator interface. Although it's not an elegant solution, you may be able to parse the logfile and use runtime information to infer what's going on.
  3. Not that i'm aware of. The source code for the utility is shipped with TestStand, but I would discourage you from customizing and rebuilding it. Is there a reason the long file names are a problem for you?


0 Kudos
Message 4 of 7

Thank you very much for your help!


My projects typically have a specialized process model (based on the parallel model) set up as default in station options in labview. I use SequenceFileLoad / Unload to initialize instruments, set up system things, etc. When starting the offline utility, I can see that it also runs the processmodel - reinitializing the instruments, thus invalidating all references etc.
If I instead specify the processmodel in my main sequence file that the test system uses, the processmodel does not start for the offline utility - but then my Operator Interface does not work either. So I'm looking for a way to disable the start of SequenceFileLoad when starting the offiline utility. Do you know of a way to accomplish this?
Using the IsEditor property will not work because I switch between the sequence editor (for debugging) and the Operator Interface (for the production people)

CLA, Teststand and advanced SQL
0 Kudos
Message 5 of 7

You can specify a callback file in your profile and define callbacks. If you don't specify one it uses the default.



0 Kudos
Message 6 of 7

I tried your proposal - I did several things

  • First creating an just an empty sequence file and specifying it as default callback. It still runs the sequenceFileLoad in my process model.
  • I also tried poiting it to the default NI models which do not contain a SequenceFileLoad
  • And I tried to create a sequence file with all callbacks for everything - also SequenceFileLoad and Unload.

But still same result - the SequenceFiledLoad in my teststand process model runs when starting the offline utility Smiley Sad

CLA, Teststand and advanced SQL
0 Kudos
Message 7 of 7