NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing Values Down Through Multiple Sub-Sequences

Solved!
Go to solution

Can someone send me an example of sending a string in a local variable in the MainSequence sequence and passing this same value down multiple sub-sequences? In other words, pass a string to sub-sequence1 and sub-sequence1 passes the same string to sub-sequence2 and sub-sequence2 passes the same string to sub-sequence3 which contains a statement step-type f(x) statement having the passed variable from the higher sub-sequences. I struggle with this all the time in TestStand. 

0 Kudos
Message 1 of 6
(1,233 Views)
Solution
Accepted by topic author TonyJ

Just use parameters.  It is really that simple.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 6
(1,225 Views)

Then use parameters for all the sub-sequences and have local variables at the very top or in the MainSequence? Sounds simple enough. 

0 Kudos
Message 3 of 6
(1,199 Views)
Solution
Accepted by topic author TonyJ

Parameters are probably best. Another, perhaps more obscure, option is to right click on the locals you want to access in your subsequences and select Propagate to Subsequence.

0 Kudos
Message 4 of 6
(1,196 Views)

Hello,

 

I think this is important to know that Locals propagation exists, thanks for that precision James. But in terms of readability, debug, understanding of the sequences, if you have to choose how to pass down values, I'm convinced propagation is not a good idea (IMHO).

 

Trick question. If I define Locals.VariableName in a sequence, with Propagate to Subsequence activated. And if that sequence calls an other on with a Locals.VariableName (same name, oops). Which one will be used in my sub sequence ? Guess what could occur if you are calling a sequence written by a collegue, of from an other team... it may be confusing.

 

This is why I strongly advise NOT using Propagate to Subsequence. Use Parameters.

 

Regards,

0 Kudos
Message 5 of 6
(1,175 Views)

I'm not advocating for using it or not, but for the sake of completeness I should mention that unless you select the Allow Propagation From Caller option, a local will not be replaced by a propagating local from a caller.

Message 6 of 6
(1,173 Views)