08-01-2013 08:43 AM
Hi,
my sequence has several subsequences with pass/fail decisions for different substeps. To save testing time my sequence does not perform the following substeps if one substep returned a FAIL as result and hence I set the Post Action On Fail: Goto cleanup.
However there are situations when I want to run all substeps also if one substep before returned a FAIL. I think a good solution would to set the Post Action differently depending on a Variable (Local, Parameter, FileGlobal, StationGlobal). For example: If the Variable is TRUE I would go to Cleanup on fail, if it is FALSE I would go to the next step on fail. I could put this into all my substeps and to change the behaviour only the variable value must be changed.
Is this possible or is there another solution for my problem?
Thanks
TT
Solved! Go to Solution.
08-01-2013 08:59 AM
Tobias,
you can configure a custom condition for post actions. If the condition is true, one post action takes place, if it evaluates to false, another takes place....
From reading your post i think this is what you are looking for.
Norbert
08-01-2013 09:26 AM
Thanks Norbert,
Yes this is what I was looking for, however I could not find out how to write On Fail: Goto Cleanup or On Fail: Goto next step in an expression and I would be grateful for some help on that.
08-01-2013 09:40 AM
Ok, this is more tricky....
The problem you are facing is that the setting for the post action is defined in the step instance. You can modify that during runtime using *any* expression, but if you fail to follow the correct format there, you will produce a run-time error.
Use the Step.TS.FailActTarget to jump as you like. The Step.TS.FailAct has to be "Goto" in order for this to work.
The next keypoint is to find the correct place for that expression. Never tested that, but it should be possible to induce it into the custom condition itself.....
hope this helps,
Norbert
08-02-2013 09:55 AM - edited 08-02-2013 09:56 AM
@TobiasT wrote:
Thanks Norbert,
Yes this is what I was looking for, however I could not find out how to write On Fail: Goto Cleanup or On Fail: Goto next step in an expression and I would be grateful for some help on that.
How about this expression:
Step.Result.Status == "Failed" && !Locals.disableGotoCleanupOnFailure
With the true condition set to go to cleanup and the false condition set to go to next step.
-Doug
08-02-2013 10:35 AM
I tried it a bit, but could not solve it so far. I'll answer again after some more trying next week.
08-05-2013 12:41 AM
@dug9000 wrote:
How about this expression:
Step.Result.Status == "Failed" && !Locals.disableGotoCleanupOnFailure
With the true condition set to go to cleanup and the false condition set to go to next step.
-Doug
This worked perfect.
I prefer to have the TRUE condition set to go to next step and the FALSE condition set to goto cleanup and I also inverted the meaning of the Local. To get this I changed my Custom Condition of my Post Action to:
Step.Result.Status != "Failed" && !Locals.enableGotoCleanupOnFailure
The result is exactly equal to your expression (as given in the de Morgan's law, but I also verified it on an easy example).
Thanks very much.
TT
08-05-2013 01:16 AM
ups there is a type in my expression above the AND must of course be an OR. So the correct expresion is:
Step.Result.Status != "Failed" || !Locals.enableGotoCleanupOnFailure
08-05-2013 09:15 AM - edited 08-05-2013 09:15 AM
Just want to point out that there is also a built-in feature for going to cleanup on failure (look near the bottom of the first tab in the station options dialog, "Immediately Goto Cleanup on Sequence Failure"). That might be a better choice if your use case is a simple, do it or don't do it setting rather than something more complicated.
-Doug
08-05-2013 09:42 AM
I did not know that, so thanks for the info.
Most of the time I'll use my solution above, since then I can choose the subsequences and the change can be made w/o the use of the Station Options. I am using Control Variables for other purposes so this new Control Variable fits nice to them.