09-14-2010 09:54 AM - edited 09-14-2010 09:57 AM
If we have a flow control step IF then we can access it's conditional expression via:
RunState.SequenceFile.Data.Seq["MainSequence"].Main["IF"].ConditionExpr
How to access this expression if we don't know the step type beforehand? I'm creating some kind of static expressions checker. I access a step via
RunState.InitialSelection.SelectedFile.Data.Seq[Locals.seqIndex].GetStep(Locals.stepIndex,Locals.groupIndex)
and if
RunState.InitialSelection.SelectedFile.Data.Seq[Locals.seqIndex].GetStep(Locals.stepIndex,Locals.groupIndex).StepType.Name == "NI_Flow_If"
then I want to apply Engine.CheckExpression method to the conditional expression of IF-step
Solved! Go to Solution.
09-15-2010 05:12 PM
Hey maksya,
Attached is a sequence file with an flow control if statement, that checks to see if the step is an "NI_Flow_If" by using:
RunState.SequenceFile.Data.Seq["MainSequence"].GetStep(0, StepGroup_Main).StepType.Name == "NI_Flow_If"
If it is, it will then call check expression on the current ConditionExpr:
RunState.Engine.CheckExpression(ThisContext, RunState.SequenceFile.Data.Seq["MainSequence"].GetStep(0,StepGroup_Main).ConditionExpr, 0, Locals.errorString, Nothing, Nothing)
You'll notice that this expression is not valid, and this is because "ConditionExpr" is not valid for all step types. However, because this step will only run IF the step is an NI_Flow_If, the expression will become valid at run-time.
Also is that I changed from using InitialSelection.SelectedFile to SequenceFile just to make the test easier to setup. However, it will be the same for your SelectedFile.
09-16-2010 02:27 AM
Great thanx, Eric! You helped me a lot.