ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Create Flow control Step types through programatically in .NET

Hi  josh,

I tried to access step result through .NET but not found any solution. I tried with the following code .

PropertyObject

objPropSeq;

objPropSeq = ObjSeq.AsPropertyObject();

if (objPropSeq.Exists("RunState.Step.DataSource", 0))

{

     bool value = objPropSeq.GetValBoolean("RunState.Step.Result.PassFail", 0);

}

0 Kudos
Message 11 of 26
(2,048 Views)

Hi  josh,

I tried to access step result through .NET but not found any solution. I tried with the following code .

PropertyObject

objPropSeq;

objPropSeq = ObjSeq.AsPropertyObject();

if (objPropSeq.Exists("RunState.Step.DataSource", 0))

{

      bool value = objPropSeq.GetValBoolean("RunState.Step.Result.PassFail", 0);

}

0 Kudos
Message 12 of 26
(2,049 Views)
rkk,
 
I noticed that you were checking for the existance of Step.DataSource.  However, that property exists for several different step types, including Pass/Fail, Numeric Limit, and String Value.
 
I think it would be better to test for the property that you are actually going to be reading; in this case "Step.Result.PassFail"
 
Also, I don't think you are using the sequence object correctly.  You will probably have better luck using Sequence.Main["Name of Step"].Result.PassFail
 
Have you used the sequence editor?  The easiest way to get this sort of information is to put a breakpoint in a sequence, and browse through your current sequence context and runstate properties.
 
Josh W.
Certified TestStand Architect
Formerly blue
0 Kudos
Message 13 of 26
(2,031 Views)
hi josh,
 
Thanks for reply. my problem is
1) I have multiple tests
2) excute them at single execution
3) display each test results( Status)
 
As per your solution I used same but it throws an error " Lookup string not found".
Sequence.Main["Name of Step"].Result.PassFail.
One more thing, "Sep.Result.PassFail" has the value "False" if step status is passed.
Can you explain me how to read step status? . I tried using "Step.Result.Status" look up string but it has value always empty.
 
regards
RKK
 
 
0 Kudos
Message 14 of 26
(2,025 Views)
Hi josh,
 
I am able to read result of sequence through the following code. But problem with that is it shows only last step result of sequence.

ObjExe.ResultStatus ( ObjExe is object of Execution).

regards Smiley Indifferent

rkk

0 Kudos
Message 15 of 26
(2,025 Views)

Hi josh,

I used following method to execute sequence file. can you tell me is it correct methdod?

1)

ObjExe = ObjEngine.NewExecution(ObjSeqFile, ObjSeq.Name, ObjSeqFile, false, ExecutionTypeMask.ExecTypeMask_Normal,

objPropertyObj, System.Type.Missing, System.Type.Missing); // ObjExe  = Object of Execution

2) To read Step result status

PropertyObject

objPropSeq;

objPropSeq = ObjSeq.AsPropertyObject();

strStepResult = ObjStep.ResultStatus; // always it is empty string.

if (objPropSeq.Exists("Step.Result", 0)) // always Exists == flase

{

string strValue = objPropSeq.GetValString("Step.Result.Status", 0);

}

Please explain me how to get each step result status. Josh I am in trouble, please help me out.

regards

RKK

0 Kudos
Message 16 of 26
(2,022 Views)

rkk,

What are you trying to accomplish?  Most of your questions from before were creating a sequence programatically.  Now you want to run that sequence as well.

What is your overall goal?
If you tell me what you are trying to accomplish, I can help you much more effectively.

Depending on what you are trying to accomplish, we can approach this in a few ways.  Though if you are going to be executing a sequence, generally the easiest way to do it is to use the TestStand UI Controls.  These are pre-built ActiveX controls that encompass much of the common functionality that you could want for executing a sequence.  I would suggest that you look at the C# code that you can find in the <TestStand>\UserInterfaces\NI\Simple\CSharp folder.  I would also reccomend reading Chapter 9 of the TestStand reference manual.  It covers User Interfaces in much more detail.

Josh W.
Certified TestStand Architect
Formerly blue
0 Kudos
Message 17 of 26
(1,990 Views)
Hi Josh,
Thanks for reply.
I want create our own GUI. I don't want to use TestStand GUI Controls.
I did successfully the following things :
1. Create steps
2. Create sequence
3. Create and save the sequence file.
4. Load the same file to execute it using TestStand API's.
 
Josh problem is I couldn't able to record the Step Result. I want use the Step result for further need.
As u explained about a break point which works perfectly on TestStand4.0 tool and  I am able to see the step results. In our tool we are not provided those options. We want to do programatically record the each step result. I used following code to execute sequence file.
 

ObjExe = ObjEngine.NewExecution(ObjSeqFile, ObjSeq.Name, ObjSeqFile, false, ExecutionTypeMask.ExecTypeMask_Normal,

objPropertyObj, System.Type.Missing, System.Type.Missing); // ObjExe  = Object of Execution

Here, after execution of above line I used following line to record the result

string strResult = ObjExe.ResultStatus. // Here I could record last step result of sequence. Actually I want record each step result.

And also I used  string strResult = ObjStep.ResultStatus // Always shows empty result.

Please explain me how to do that?

regards

RKK

 

 
0 Kudos
Message 18 of 26
(1,987 Views)

rkk,

The information you are looking for is stored in the Locals.ResultList array.  After a step is run, that step's result container is put into this array.  You *might* be able to recover it by simply accessing that array via a lookup string.

However, the problem you are trying to solve is how to get information from a running sequence back to a GUI.  The best way to accomplish this is by posting UI messages from your sequence and handling them in your GUI.  I recommend you do a search on this forum for UIMessages.  You will find a lot of help on how to use them.

I understand that you don't want to use the TestStand GUI controls for your display.  However, the three manager controls can still run a sequence without displaying any information.  I think that this will be a better idea than the way you are doing it.

Josh W.
Certified TestStand Architect
Formerly blue
0 Kudos
Message 19 of 26
(1,985 Views)
Hi Josh,
Thanks for reply.
Could you please explain me about the manager and their usage with example.
 
Thank you,
 
Regards
RKK
0 Kudos
Message 20 of 26
(1,982 Views)