08-09-2019 08:10 AM - edited 08-09-2019 08:23 AM
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
Solved! Go to Solution.
08-09-2019 08:47 AM
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.
08-09-2019 08:50 AM
Would it be possible to set a boolean flag and use that boolean flag as Precondition for the step?
08-09-2019 09:15 AM
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.
08-09-2019 09:33 AM
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?
08-09-2019 10:23 AM
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.
08-09-2019 11:36 AM
Step object is ok.
The issue is on context argument which should be a variant. If i dont specify argument, the fonction returns "normal"
08-09-2019 12:15 PM
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.
08-12-2019 02:46 AM
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