From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Disable Database on Abort

Solved!
Go to solution

Hello Community,

 

Using Teststand 2014 32bit

 

In a previous post of mine, I asked how to programmatically enable/disable database result processing. I got my answer and it dealt with altering the sequence file callback "DatabaseOptions". Is there a way to edit the parameter in my DatabaseOptions during my MainSequence? My reason for this, is when the user is running the sequence file and decides to abort during the test based off a message popup selection. I do not want teststand to process the results to the database when the user cancels the test and skips to cleanup. Is there a way to cause Teststand to not write to the database in this scenario?

0 Kudos
Message 1 of 7
(3,730 Views)

Hey,

 

Have you seen this knowledgebase on modifying the DatabaseOptions parameter?

http://digital.ni.com/public.nsf/allkb/6881C94CAABA677386256CDF005C3149

 

And maybe you can DisableResults for your case when the user aborts?  http://zone.ni.com/reference/en-XX/help/370052H-01/tsapiref/reftopics/execution/

 

Thanks,

Jonathan R.
Applications Engineer
National Instruments
Message 2 of 7
(3,699 Views)

It's important to distinguish between terminating and aborting.

 

You should be able to override the LogToDatabase callback and check the MainSequenceResults to see if the sequence was Terminated before logging to the database. 

 

terminated.PNG

 

You won't have as much luck handling an aborted sequence since the execution stops almost immediately.

 

-Trent

https://www.linkedin.com/in/trentweaver
0 Kudos
Message 3 of 7
(3,692 Views)

I made a simple sequence file to try it out with one numeric test step. I can't seem to disable the database during runtime. In the LogToDatabase is there a specific expression I should run in a statement? Whatever I tried didn't seem to work.

0 Kudos
Message 4 of 7
(3,666 Views)

What I had in mind was setting a Precondition on the "Call LogToDatabase in case... " sequence call step that lookes something like:

Parameters.MainSequenceResults.Status != "Terminated"

Hope this helps,

Trent 

https://www.linkedin.com/in/trentweaver
Message 5 of 7
(3,657 Views)

My setting for Configure -> result processing -> database is set to enabled.

In the sequence file callback LogToDatabase I am able to change the ConnectionString and keep the Database from recording results by having it go to a decoy database. I did this because when I try changing DisableDatabaseLogging to not record my data, it still does. Is there a way in my MainSequence to change a global variable that will cause my database to not record results during the LogToDatabase?

0 Kudos
Message 6 of 7
(3,447 Views)
Solution
Accepted by topic author MechUnit

I'm not sure that I follow what's going on here.

 

Are you still trying to prevent database logging in the event an execution is terminated? What I described above should do this. See the attached sequence file (i tested this out with the shipping example database).

 

As for changing the ConnectionString in the LogToDatabase callback, this is likely not doing what you're expecting. A new connection is made only if one doesn't already exist (even if you change the connection string at runtime). If you're really trying to switch the database you're logging to in the middle of an execution, there are ways to go about this, but I wouldn't recommend it if you're only trying to prevent logging in particular situations. The method i proposed earlier would be much cleaner to implement.

 

Hope this helps,

Trent

https://www.linkedin.com/in/trentweaver
0 Kudos
Message 7 of 7
(3,434 Views)