NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing Variables Between MainSequence and xxx.SEQ Files

I am trying to understand how to do this with my current test stand setup.

 

I have a Main.seq file which has the standard MainSequence subsequences. In the Main, I call a number of .seq files that I treat as subsequences. I have not added a subsequence like this: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YI5HCAW&l=en-US 

 

So now I'm trying to figure out what the best way to pass data from inside the subsequence.seq to the Main.seq without completely changing they way I use TestStand. 

 

I'm trying to understand if FileGlobals is the way to go, but can't find examples of it in use. Below is my scenario where I'm trying to process the results in Main.seq, rather than in TestA.seq. Ideally I would actually like to have a ResultsProcessA.seq on the same level as TestA.seq, but I'm still learning how to pass variables between the two.

 

Main.seq

     TestA.Seq

          CustomResultsVariable

 

What this really comes down to is the following scenario Test A and Test B, are continuity tests for a PCB test. If we detect failures, I do not want to log those results to teststand immediately, I want to give them the option to retry so I loop the test if they click "Retry", if they click "Fail" then it will log results. So what I've done is used the evaluate, with Result Recording Option DISABLED for Test A and B. If both tests pass, then I want to re-process the results with Result Recording Option ENABLED and continue testing. I was thinking that I could make a Process Results.seq once Test A/B are passed or the operator click failed. My issue is I don't know how to pass data between sequences "on the same level". I am okay with the idea of not adding a subsequence and instead processing in Main.seq if needed. 

 

Main.seq

     TestA.seq

     TestB.seq

     ------------- *Potentially want to add* Process Test A & B Results.seq

     Test1.seq

     Test2.seq

 

 

Thanks in advance

0 Kudos
Message 1 of 4
(701 Views)

Hi, 

Did you try using "By Reference" parameters to pass data from sub-sequence.seq back to the Main.seq?

Regards, 

Anand Jain

NI

0 Kudos
Message 2 of 4
(672 Views)

I just found out how to do that. I think there's some sort of bug/lack of feature in TS. When you copy a variable from Locals its by default "by value" whereas if you create one in parameters its "by reference" and there's no way to explicitly change the reference type after its created. This wasted a solid day of effort.

Going to try re-working my solution, with by reference.

0 Kudos
Message 3 of 4
(665 Views)
  • TestStand has a Callback event "SequenceFilePostStepFailure" if a step fails, you can use this to your advantage instead of creating your own subsequence.
  • Choosing how steps will be logged is best left to filtering settings in the report options.

Here is a strategy that you can use:

  1. Set your PCB measurement steps Run Options: Result Recording Option back to Enabled
  2. Add the Sequence File Call Back "SequenceFilePostStepFailure" to your test sequence file
  3. Edit the SequenceFilePostStepFailure sequence and add 2 steps
    1. Message Popup step.  This step has the "Retry" and "Fail" button options.  Sounds like you already have this.
    2. Add an Expression step that simply sets the calling steps status based on what the user chose in the Popup step.  The expression is:
RunState.PreviousStep.Result.ButtonHit == 1 ?  Parameters.Step.Result.Status = "NoLog", RunState.Caller.NextStepIndex = RunState.Caller.StepIndex : ""

If the user chooses "Retry", the expression step sets the status to "NoLog"; you can do whatever you want...could even set it to an empty string.  And, the caller NextStepIndex is set to the caller step so that the test will run again.  If the user chooses Fail, the test will not re-run and will log the Failed result in the report.

 

Then, in the report Options plugin set the Result Filtering Expression:  Result.Status != "NoLog"

eejallen_0-1709142452586.png

So, the re-tested Steps will always have "NoLog" and will not be logged.  Passed and Failed tests will be in the report.

 

Good Luck.

0 Kudos
Message 4 of 4
(653 Views)