NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing RunMode Step by itself

Solved!
Go to solution
Highlighted

Hi all,

 

I'd like to change step runmode (to skip) in the code module call by this step.

I tried function SetRunModeEx with no error. But when I read runmode in post step callback, the runmode is "normal"

And in report, the status is "passed"

 

does it be possible?

Thanks for your help

 

0 Kudos
Message 1 of 9
(243 Views)

Can you post a code snippet?  I have used SetRunModeEx successfully.  

 

The code snippet below works for me.  Hopefully, you're getting the step reference correctly elsewhere in your code.  I have also found that wiring the Execution reference to the executionParam input fixed a bug related to multithreading.

0 Kudos
Message 2 of 9
(223 Views)

Would it be possible to set a boolean flag and use that boolean flag as Precondition for the step?

0 Kudos
Message 3 of 9
(219 Views)

Of course, you can use a boolean as a precondition.  That would be much more straightforward.  I use setrunmodeex because I give my users the option to skip a number of steps.

0 Kudos
Message 4 of 9
(203 Views)

I made a mistake, it's working now.

 

I'd like to get run mode with C++ code but I don't know how.

 

step->GetRunModeEx needs a t_variant_t for executionParam

I Tried this : 

step->GetRunModeEx(_variant_t(seqContext->Execution)) == _bstr_t("Skip")

but I get a runtime error.

 

Do you have an idea please?

 

 

0 Kudos
Message 5 of 9
(197 Views)

I haven't tried this with C++ code before, but your code looks reasonable to me.  I would doublecheck how you're getting step.  Also, the executionParam parameter is optional; maybe you could try the code without that.  

0 Kudos
Message 6 of 9
(180 Views)

Step object is ok.

The issue is on context argument which should be a variant. If i dont specify argument, the fonction returns "normal"

 

0 Kudos
Message 7 of 9
(174 Views)

That makes sense since I'm guessing in your sequence, it's set to Normal, but you're trying to see if the precondition is normal or skipped during run time.  Unless you're somehow getting Execution incorrectly, your code looks like it should work.  

 

Can you check getting Execution by checking something like ThisContext.Execution.GetSequenceFile().Path?  (That's (pseudo) TestStand code.)  If that works, I'm not sure what else to suggest.

0 Kudos
Message 8 of 9
(163 Views)
Solution
Accepted by topic author maxmont

Hi All,

 

I managed to fix the issue with this modification : 

step->GetRunModeEx(_variant_t(seqContext->Execution, false)) == _bstr_t(L"Skip")

 

It's working now, thanks

 

0 Kudos
Message 9 of 9
(103 Views)