NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Which VB6 API to use for Resultlist

Solved!
Go to solution

Hello,   I am trying to extract portions of the resultlist from teststand 3.5 in VB6.  In particular, I trying to get the err.code and err.msg from the last step in which the error was reported in teststand.   I am not sure which API object to use.      In 'teststand help' index, I notice a STEP_RESULT Table Schema, which contains error_code and error_message, but I'm not sure how to apply in VB6.

 

 

0 Kudos
Message 1 of 12
(5,853 Views)

Hi,

 

Where are you trying to do this, Client SequenceFile, Process Model SequenceFile, Report, DateBase?

 

 

 

Regards

Ray Farmer

Regards
Ray Farmer
0 Kudos
Message 2 of 12
(5,851 Views)
Please excuse my lack of information.  I'm new to teststand, but experienced in VB.   I'm using a sequence file, but not sure of the difference between process model and client.  In my sequence file, under cleanup tab, I call a VB class through a VB object server. I pass in a sequence context to my VB class.   Not sure how to get the err.code and err.msg from locals.Resultlist from the last step that failed.   Maybe it would be easier to get the failure information from the report.   I'm not sure.
0 Kudos
Message 3 of 12
(5,847 Views)

Hi,

 

Client SequenceFile is your SequenceFile and when you execution your MainSequence via Single Pass or Test UUT's entry point, this means it will execute your Top Level sequence (MainSequence) with the Process Model Sequence, either Single Pass or Test UUT's.

 

Do you not action on the Error at the step it occurs?

Why do you want to extract the error details from the ResultList.

 

You could use one of the Callback Sequences, such as SequenceFilePostError or SequenceFilePost ResultList.

 

Anyway find attached, is an example I did along time ago. This sequence searches through the ResultList and removes Skipped Steps. You should be able to scan through it and convert it to met your requirement either using the TS activex steps or in your VB code

 

Example: http://zone.ni.com/devzone/cda/epd/p/id/2026

 

 

Regards

Ray Farmer

 

 

 

 

Regards
Ray Farmer
Message 4 of 12
(5,841 Views)

I do 'action' when an error occurs.  I was just trying to extract the details of the resultlist to also display to a VB form.   I briefly looked over what you sent, but still not quite sure how to extract from a VB class.   I'll dig a little deeper.

 

0 Kudos
Message 5 of 12
(5,822 Views)

delphi Dan wrote:
Please excuse my lack of information.  I'm new to teststand, but experienced in VB.   I'm using a sequence file, but not sure of the difference between process model and client.  In my sequence file, under cleanup tab, I call a VB class through a VB object server. I pass in a sequence context to my VB class.   Not sure how to get the err.code and err.msg from locals.Resultlist from the last step that failed.   Maybe it would be easier to get the failure information from the report.   I'm not sure.

From the sequence context you can get info from the result list array (Note, this isn't VB syntax, but you should be able to figure out the equivalent if you are familiar with VB).

 

PropertyObject resultList = seqContext.Locals.GetPropertyObject("ResultList", 0);

 

long numElements =  resultList.GetNumElements();

 

PropertyObject lastElement =  resultList.GetPropertyObjectByOffset(numElements - 1, 0);

 

String errmsg = lastElement.GetValString("Error.Msg", 0);

long errcode = lastElement.GetValNumber("Error.Code", 0);

 

Hope this helps,

-Doug

 

 

Message 6 of 12
(5,800 Views)

Dan -

 

From your previous posts, I assume you are using one of the older versions of TestStand (3.5 perhaps). Rather than attempting to figure out which step was the last to error and getting the error code and message from it from within your "VB class" using the sequence context, I recommend the following:

 

1. Select the All Sequences View from the View drop-down box

 

 

allSequences.png

 

 

2. In the open space, right-click and select Sequence File Callbacks...

 

 

seqFileCallbacks.png

 

 

3. Add the SequenceFilePostRuntimeError Engine Callback

 

 

add.png

 

 

4. You should now be able to select the SequenceFilePostRuntimeError callback sequence from the View drop-down box. During execution of your normal sequence, this sequence will execute immediately after a step errors and before the next step executes. To get an idea of exactly when this sequence executes during a step, see the Step Executions table of the TestStand Reference Manual. Within this sequence, you have two options:

 

1. You can pass the Parameters.Result.Error.Code and Parameters.Result.Error.Msg straight to your "VB class" and store them in global variable. With this method, the global variables within your "VB class" will always be set to the latest step error code and message. Once you get to the point where you actually need to perform an operation based on this information in your "VB class", you would simply access these global variables.

 

2. You can store the Parameters.Result.Error.Code and Parameters.Result.Error.Msg in FileGlobal variables. Again, with this method, the FileGlobal variables will always be set to the error code and message of the last step to error. When it comes time to call your code module to actually process the error code and message, you can simply pass the FileGlobal variables directly to your "VB class".

 

Hope this helps.
Manooch H.
National Instruments
Message 7 of 12
(5,785 Views)

Sorry, forgot to provide links:

 

Step Executions Table

 

TestStand 4.2 Reference Manual 

 

Engine Callbacks

 

Hope this helps.

Manooch H.
National Instruments
Message 8 of 12
(5,748 Views)

Ok, I did everything you posted, but having problems at step 4.   First of all, the link to teststand reference goes to a HTTP status error.  I created a FileGlobalvar called Fileglobals.Errorcode.   I then created the following statement in SequenceFilePostRuntimeError "Fileglobals.Errorcode = Parameters.Result.Error.Code".    The program crashes at this statment, because only the Parameters.Result container exists.   The Error.Code object isn't there.   What am I doing wrong?  Remember, I am a TestStand novice.

 

0 Kudos
Message 9 of 12
(5,733 Views)
Solution
Accepted by topic author DelphiDan

My apologies Dan. Here is the link to the TestStand 4.2 Reference Manual.

 

For step 4 of my post above, please replace Parameters.Result with Parameters.Step.Result.

 

For example, instead of Parameters.Result.Error.Code, you would use Parameters.Step.Result.Error.Code.

 

Hope this helps.

Manooch H.
National Instruments
Message 10 of 12
(5,728 Views)