NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling order of database logging

I'm using database logging with a custom schema and stored procedures to log my test results. The stored procedures must be called in a certain order during the same session because session variables are used to store some foreign keys. This improves database security by hiding keys from the application. The problem is that I don't know how to make sure the stored procedures are executed in the right order. The order should be:

1. open_sequence()
2. add_step_data() repeat for each step result
3. close_sequence()

Any suggestions? I tried putting the open/close stored procedures in separate steps in the Log to Database sequence, but in that case I have to open a separate database connection, so the shared session variables don't
work on the database side. If there is a way to share the connection, that might be another solution.
0 Kudos
Message 1 of 4
(3,294 Views)
Hi Mark,

The only way to dictate the order in which statements are executed is the order in which you listed them in the Database Options dialog (Configure >> Database Options in the Sequence Editor). During execution of the TestUUTs or SinglePass entry points of whichever model you chose to use, the LogToDatabase model callback has a single step that executes a method of the TestStand database logging activex automation server to perform all of the specified statements in a schema in the order that they appeared in that list.

Jason F.
Applications Engineer
National Instruments
www.ni.com/ask
0 Kudos
Message 2 of 4
(3,294 Views)
Mark -
Jason's response is talking about TestStand 2.0 which is very different than TestStand 1.x for its database logging feature. Your question was not clear as to what version you are using.
Scott Richardson
https://testeract.com
0 Kudos
Message 3 of 4
(3,294 Views)
Scott/Jason,

Thanks for your responses. I'm using 2.0 and I found a solution to my problem. At the end of my sequence I added a custom step with a "LastResult" property. I then key off that property to call the Close_Sequence() stored procedure. TestStand's support for stored procedures has made my job much easier!
0 Kudos
Message 4 of 4
(3,294 Views)