NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Database options Logging Custom Error Codes and Messages

Solved!
Go to solution

I am using TestStand 4.5 with the standard SQL database schema supplied. I noticed that in the UUT_RESULT table the only time a UUT_ERROR_CODE or UUT_ERROR_MESSAGE is written is when the UUT_STATUS is Error. I would like to be able to log our custom FileGlobals.Error_code and FileGlobals.Error_text into these fields when the UUT fails a test.

I would rather not change the schema but just get help on how to get my global variables into the correct fields.

 

Thanks in advance.

Steve

0 Kudos
Message 1 of 8
(3,846 Views)

Steve,
I'm not certain if it is possible to log to the built-in Error code and message columns. Something to consider is that if you modify this field, then all steps will not be able to log their own error codes and messages.


I would recommend you create additional columns in your database schema, and add the FileGlobals.Error_code and FileGlobals.Error_text as Custom Step Properties that get logged to the Database. A step-by-step guide on how to do this is located at:


KnowledgeBase 2RI6DAO6: Logging a Custom Step Property to a Database from TestStand

Jared A.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 8
(3,824 Views)
Solution
Accepted by topic author sdrochek3

Steve -

To accomplish what you are trying to do, ie. set the UUT error code and message without updating the database schema, you would have to modify the entry points for Single Pass and Test UUTs for the models that you are using. You would need to add a step after the MainSequence call step that evaluates if the call to MainSequence failed, and if it did, modify the last result placed in Locals.ResultList array. You would need to set the Locals.ResultList[x].Error.Code and Locals.ResultList[0].Error.Msg properties on this result to the global values that you mentioned. If the file global values are in the model file, then it is an easy assignment. If the file global value is in the client file or some other file, you will need to pass it back to the entry point somehow. Many options: store values in station global and model entry point will retrive values, have client assign value to local in entry point using expresion like RunState.Root.Locals... or create temporary properties on Execution.RunTimeVariables container that the model entry point will access determine if exists and pull the values from. You will need to make sure that the previous values are cleared before starting the next UUT. Hope this helps...

Scott Richardson
Message 3 of 8
(3,818 Views)

Scott,

Thanks for the help I did not have to change the schema.

In the PostUUT sequence I set a Precondition: Parameters.Result.Status = "Failed"

I made the expression: RunState.Root.Locals.ResulList[0].Error.Msg = FileGlobals.Error_text

This passes my fail messages then to the Database. I will have to do a little work for the Error numbers since they are in text form in each of the messages but this will work great for us.

 

Thanks again!

Steve

0 Kudos
Message 4 of 8
(3,816 Views)

Great, thanks for letting us know.

Scott Richardson
Message 5 of 8
(3,805 Views)

Scott,

 

I know this is an old thread but I am trying to do enter a message from the operator for when they terminate the test.

However, I am using a precondition on a Message Popup : Parameters.Result.Status == "Terminated" but this only appears to be evaluated in the PostUUT.seq which runs after the LogToDatabase.seq.

Do you know of a method I could use to capture this information?

0 Kudos
Message 6 of 8
(3,233 Views)

Steve,

 

You should be able to find a callback that is being called during termination, and you can modify the behavior in that callback to display the Message Popup. That said, it is probably best if you post a new thread for this question. This is an old thread, and so it will not have a lot of traffic or visibility, so you will probably get a better answer if you start a new thread for this.

William R.
Applications Engineer
National Instruments

William R.
0 Kudos
Message 7 of 8
(3,218 Views)

sdrochek3 -

There is no simple callback to access the time after MainSequence and before logging. The simplest options are:

1) Put the functionality in the Cleanup portion of the client sequence file you are invoking

2) Update the process model entry point directly and add the functionality after the call to MainSequence

 

Scott Richardson
0 Kudos
Message 8 of 8
(3,213 Views)