Setting the Expression Type
Before you can add a new expression (either Expression 1 or Expression 2) to your QueryCriteria, you must set the type for the expression.
The following code example adds a new criteria, sets the type for the first expression, adds the first expression to the main select of the query definition, then does the same thing for the second expression.
&MyQuerySelect = &MyQuery.QuerySelect;
&MyCriteria = &MyQuerySelect.AddCriteria();
/* make expression 1 a field */
&MyCriteria.Expr1Type = %Query_ExprField;
/* add the ABSENCE_TYPE field */
&MyCriteria.AddExpr1Field("A", "ABSENCE_TYPE");
/* make it not equal to */
&MyCriteria.Operator = %Query_CondNotEqual;
/* Make expression 2 a constant */
&MyCriteria.Expr2Type = %Query_ExprConstant;
&MyCriteriaExpr = &MyCriteria.AddExpr2Expression1();
&MyCriteriaExpr.Text = "VAC";