NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Jump To Subsequence Within Main Sequence Using Post Action

Solved!
Go to solution

Hi everyone,

 

I have 4 subsequences that run one after another within my "Main Sequence."  Within the 4th subsequence, I have a step that checks whether a boolean is TRUE.  If the boolean is TRUE, I want to jump to the 1st Subsequence using the step's post action.  Then I expect the code to jump to the 1st Subsequence, run the 1st Subsequence, then run the 2nd Subsequence, then run the 3rd Subsequence, and then run the 4th Subsequence and check if the boolean is TRUE again.  If it is TRUE, I will jump back to the 1st Subsequence and start all over again.  If it is FALSE, I will finish executing the sequence file.

 

What is the syntax in the post action selection I need to use?  Thanks!

0 Kudos
Message 1 of 17
(4,530 Views)

Is this another step?  Or would it be the post action of sequence 4?  If it's another step then just the the GoTo step with a precondition of your boolean.

 

If it's the post action of Step 4 then Check the Use Custom Condition.  Put your boolean in there.  On the True condition select Goto step and then select the call to sequence 1.

 

Hope this helps,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 2 of 17
(4,521 Views)

Hi,

This can be done by using a sequence parameter and evaluating it once the subsequence has completed:

  1. create a local in the main sequence, called Locals.ReturnBoolean
  2. add a boolean parameter to the fourth sub-sequence, called Parameter.ReturnBoolean
  3. set the parameter to use Locals.ReturnBoolean by reference
  4. within the fourth sub-sequence, set Parameter.ReturnBoolean to True or False
  5. set the Post Action of the fourth sub-sequence to the following:

Post Action.PNG

 

See the attached example sequence file.

 

Regards,

Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)

Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor

Message 3 of 17
(4,519 Views)

From a style point of view, I'd personally prefer to use a Do...While flow control structure, rather than use a Post Action because:

(A) I think it's easier to read and understand the intention of the sequence

4 Sequence Retry VS.PNG

 

(B) It's immediately more flexible - I can add or re-order steps anywhere into the Do...While, but with the Step Post Action I have to go and modify the target of the Post Action if I move the first sequence or want to add something before it.

 

I've attached an example of the solution using Do...While.

 

I hope this helps. 

Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)

Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor

Message 4 of 17
(4,517 Views)

Charlie/Jiggawax,

 

Thanks for your replies.  I am trying to jump from a step post action within a subsequence (subsequence #4) to another subsequence.  Please see pictures below.  The first picture shows the high level main sequence with the 4 subsequences and the second picture shows the 4th Subsequence with a steps post action.  When that step runs, if the RetryTest boolean = True I want that steps post action to jump to Subsequence 1 in the main sequence so that it will run from subsequence 1 all the way back to subsequence 4 step to evaluate RetryTest boolean.

 

I am trying to figure out what to set the Go To Step (see highlighted in red in second picture) function too to jump back up to Subsequence 1.

 

Thanks for your help. 

 

JumpToSubsequence 1.pngJumpToSubsequence 2.png

0 Kudos
Message 5 of 17
(4,461 Views)

Well I'm not sure if you can do it like that, i.e have a subsequence step go to a calling sequence step directly...

 

4 Sequence Retry 3.PNG

 

I would have thought you have at least let it return back through the call stack and have the Post Action on the call to the subsquence...

 

4 Sequence Retry 4.PNG

Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)

Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor

0 Kudos
Message 6 of 17
(4,458 Views)

What you could do is reset the Main Sequence step index if you wish to retry, by using the following expression in a statement in Subsequence 4:

 

RunState.Caller.NextStepIndex = (Locals.RetryTest == True ? 0 : RunState.Caller.NextStepIndex)

 

(Example attached)

 

I hope this helps,

Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)

Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor

Message 7 of 17
(4,452 Views)

Charlie,

 

I am using Test Stand 2013 and am unable to open the file you attached because it is 2014.  Can you resave the file as Test Stand 2013?  Thanks!

0 Kudos
Message 8 of 17
(4,450 Views)
Solution
Accepted by topic author testdesign

Example 1 - Post Action on Subsequence 4 call

Example 2 - Do..While

Example 3 - Resets Main Sequence step index

Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)

Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor

Message 9 of 17
(4,448 Views)

Charlie,

 

This resolved my issue.  Thanks for all the help!  Enjoy your Thanksgiving.

0 Kudos
Message 10 of 17
(4,426 Views)