|Download Help (Windows Only)|
AnalysisUtilities.ValidateExpression ( expression, baseLocation, apiLocation, validTypes, evaluationOptions, additionalConstants, evaluationFlags)
Use this method in an analysis module to validate an expression. An analysis module can call this method to perform expression validation on any property that is not an instance of the Expression data type or to perform custom expression validation beyond syntax errors, such as type checking.
If the analysis module calls this method on expression properties within a step, the analysis module must set the AnalysisUtilities.AutomaticPropertyCheckingEnabled property to False to ensure that the sequence analyzer does not report duplicate messages, and the analysis module must perform all path and expression property checking for the step.
If the rules are enabled, this method reports analysis messages for the NI_ExpressionEvaluationError, NI_DynamicPropertyDoesNotExist, and NI_EscapeSequenceValid rules. This method also finds variables in the expression to determine which variables are used for the NI_UnusedVariables rule.
If you set the AnalysisUtilities.AutomaticPropertyCheckingEnabled property to True, the built-in analysis modules call this method with the evaluationFlags parameter set to ValidateExpressionOption_NoOptions for all properties of type Expression.
expression As String
[In] Pass the expression to validate.
baseLocation As PropertyObject
[In] Pass the base object to use with the apiLocation parameter as the location associated with any analysis messages this method reports.
apiLocation As APILocations
[In] Pass the APILocations enumeration to use as the location associated with any analysis messages this method reports. To use the baseLocation as the location, pass APILocation_None.
validTypes As EvaluationTypes
[In] Pass the type or types to which you expect the expression to evaluate.
evaluationOptions As Long
[In] Pass any combination of the EvaluationOptions constants. You do not need to pass the EvalOption_DoNotAlterValues constant because this method never changes values.
additionalConstants As Object Array
[In] Pass additional variables the expression might contain that are not part of the context. This parameter is useful if the expression contains a constant from an enumeration, such as a parameter value of a module call when the parameter type is an enumeration. You can pass NULL for this parameter if no additional constants you want to use exist when evaluating the expression.
evaluationFlags As Long
[In] Pass a combination of the ValidateExpressionOptions constants.