03-18-2021 12:22 PM
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.
Solved! Go to Solution.
03-18-2021 12:32 PM
Just use parameters. It is really that simple.
03-18-2021 01:43 PM
Then use parameters for all the sub-sequences and have local variables at the very top or in the MainSequence? Sounds simple enough.
03-18-2021 01:58 PM
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.
03-18-2021 04:52 PM - edited 03-18-2021 05:16 PM
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,
03-18-2021 04:57 PM - edited 03-18-2021 04:59 PM
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.