01-21-2013 06:55 PM
I would like to dynamically set the "Enable Switching" checkbox in the Switching properties of a step. I thought that setting the Step.SwitchExecEnabled variable to False in a pre-expression would disable switching, but it doesn't. I did find that if I uncheck "Enable Switching" and set Step.SwitchExecEnabled to True, the second time I execute the step, switching will be enabled. So it seems that the issue may be in the execution order between the pre-expression and the switching.
The reason I want to dynamically change the setting is that the same software must run on systems that may or may not have switching hardware. I cannot use a precondition because I still want the step to execute. I just want to skip the switching in some cases. One workaround is to put the switching in a separate step, but there are many steps so I would like to avoid that if possible.
I'm using TS 2010.
01-22-2013 09:43 AM
The only thing that executes before the switching is the precondition. You could change the switching setting in the precondition as follows:
Step.SwitchExecEnabled = StationGlobals.SwitchingEnabled, True
The ", True" at the end of the expression ensures that the preconditions still evaluates to True so that the step still executes. In a compound expression like this, the result of the combined expression is the result of the last expression.
Hope this helps,
-Doug