11-09-2021 04:32 AM
I am making an Edit Step dialog for a custom step type, Multiple String Value Test. The step type is set up like String Value Test only that it has a Measurement array like Multiple Numeric Limit Test. The measurement type has, among other properties, String, StringExpr, and UseStringExpr just like Limits in StringValueTest.
In the Edit Step dialog I use an ExpressionEdit ActiveX control to enter the string limit, either an expression that evaluates to a string or a literal string. When the text in the ExpressionEdit is an expression I want to set the value to StringExpr property on the measurement type and set UseStringExpr to True. When the text in the ExpressionEdit is a string I want to set the value to String property on the measurement type and set UseStringExpr to False, just like String Value Test does.
How do I differentiate between an expression and a string in an ExpressionEdit?
See attached images if you are unsure what I mean.
Solved! Go to Solution.
11-09-2021 11:00 AM
I think you are looking for Expression.GetConstantValue.
11-10-2021 03:04 AM
Thank you, it looks like Expression has what I need.
If Text is empty it is not an expression,
if Text has more than 1 token or it is not a constant value (GetConstantValue returns null) it is an expression,
else it is not an expression.