QueryCriteria Class Properties

In this section, we discuss the QueryCriteria class properties. The properties are discussed in alphabetical order.

Description

This property returns a reference to the QueryExpression object that's used as Expression 1.

This property is valid only when Expression 1 exists as an expression. If you want to add an expression for Expression 1, use the AddExpr1Expression method.

This property is read/write.

Related Links

AddExpr1Expression

Description

This property returns a reference to the QueryField object that's used as Expression 1.

This property is valid only when Expression 1 exists as a field. You can then use the QueryField Class methods and property to manipulate this object.

If you want to add a field for Expression 1, use the AddExpr1Field method.

This property is read-only.

Description

This property returns or sets the type for Expression 1.

Note: You must set the type of expression for every new criteria.

The values are:

Numeric Value

Constant Value

Description

2

%Query_ExprField

Field

3

%Query_Expression

Expression

This property is read/write.

Example

The following is used to test the expression to determine the property to use to retrieve it:

&MyExpr1 = &MyCrtColl.Next(); 
If &MyExpr1.Expr1Type = %Query_ExprField Then /* Expression is a Field */ 
 
   &OldExpr1Value = &MyExpr1.Expr1Field; 
   /* do processing */ 
 
Else  /* Expression 1 is an expression */ 
 
   &OldExpr1Value = &MyExpr1.Expr1Expression; 
   /* Do processing */ 
 
End-if;

The following is an example showing how to add a field for Expression 1.

/* add a new criteria */ 
&MyCriteria = &MyQuery.AddCriteria(); 
 
/* set the type of the first expression to be a field */ 
&MyCriteria.Expr1Type = %Query_ExprField; 
 
/* add the field EMPLID from the ABSENCE_HIST record */ 
&MyField = &MyCriteria.AddExpr1Field("A", "EMPLID");

Description

If the Between relational operator is used in the criteria, there can be two constants for Expression 2. This property returns or sets the constant value for the first constant for Expression 2. This property takes a string value.

This property is valid only when Expression 2 is defined as a constant.

This property is read/write.

Description

If the Between relational operator is used in the criteria, there can be two constants for Expression 2. This property returns or sets the constant value for the second constant for Expression 2. This property takes a string value.

This property is valid only when Expression 2 is defined as a constant.

This property is read/write.

Description

If the Between relational operator is used in the criteria, there can be two expressions for Expression 2. This property returns a reference to the first QueryExpression object that's used as Expression 2.

This property is valid only when Expression 2 exists as an expression. To add an expression for Expression 2, use the AddExpr2Expression method.

This property is read/write.

Related Links

AddExpr2Expression

Description

If the Between relational operator is used in the criteria, there can be two expressions for Expression 2. This property returns a reference to the second QueryExpression object that's used as Expression 2.

This property is valid only when Expression 2 exists as an expression. To add an expression for Expression 2, use the AddExpr2Expression method.

This property is read/write.

Related Links

AddExpr2Expression

Description

If the Between relational operator is used in the criteria, there can be two fields for Expression 2. This property returns a reference to the first QueryField object that's used as Expression 2.

This property is only valid when Expression 2 exists as a field. You can then use the QueryField Class methods and property to manipulate this object.

To add a field for Expression 2, use the AddExpr2Field1 method.

This property is read-only.

Description

If the Between relational operator is used in the criteria, there can be two fields for Expression 2. This property returns a reference to the second QueryField object that's used as Expression 2.

This property is valid only when Expression 2 exists as a field. You can then use the QueryField Class methods and property to manipulate this object.

To add a field for Expression 2, use the AddExpr2Field2 method.

This property is read-only.

Description

This property returns a reference to the QueryList object of Expression 2 that's used when the Operator is of type In List (or Not In List).

This property is read-only.

Description

This property returns a reference to the QuerySelect object that's used as a subquery for Expression 2.

This property is valid only when Expression 2 exists as a subquery. To add a subquery for Expression 2, use the AddExpr2Subquery method.

This property is read-only.

Related Links

AddExpr2Subquery

Description

This property returns or sets the type for Expression 2. The following table lists all of possible values for this property. However, the values for this property are dependent upon the Operator property.

This property is read/write.

See Operator, Working With Query Criteria and Expressions.

You can use either a constant or numeric value for this property. The values are:

Numeric Value

Constant Value

Description

1

%Query_ExprConstant

Constant

2

%Query_ExprField

Field

3

%Query_Exprression

Expression

4

%Query_ExprSubQuery

Subquery

5

%Query_ExprList

List

6

%Query_ExprCurDt

Current date

7

%Query_ExprTree

Tree

8

%Query_ExprBind

Bind

9

%Query_ExprBothConst

The criterion's operator is Between and both values on the right-hand side are constants. (Const-Const)

10

%Query_ExprConstFld

The criterion's operator is Between, the first value on right-hand side is a constant and the second value is a field. (Const-Field)

11

%Query_ExprConstExpr

The criterion's operator is Between, the first value on right-hand side is a constant and the second value is an expression. (Const-Expr)

12

%Query_ExprFieldConst

The criterion's operator is Between, the first value on right-hand side is a field and the second value is a constant. (Field-Const)

13

%Query_ExprBothFld

The criterion's operator is Between and both values on the right-hand side are constants. (Field-Field)

14

%Query_ExprFldExpr

The criterion's operator is Between, the first value on right-hand side is a field and the second value is an expression. (Field-Expr)

15

%Query_ExprExprConst

The criterion's operator is Between, the first value on right-hand side is an expression and the second value is a constant. (Expr-Const)

16

%Query_ExprExprFld

The criterion's operator is Between, the first value on right-hand side is an expression and the second value is a field. (Expr-Field)

17

%Query_ExprBothExpr

The criterion's operator is Between and both values on the right-hand side are expressions. (Expr-Expr)

18

%Query_ExprTreePrompt

Tree prompt

The following table describes how to access or change Expression 2 depending on the Expression2 Type.

Expression2 Type

Method or Property for Changing the Expression

Method or Property for Accessing the Expression

Constant

Expr2Constant

Expr2Constant

Field

AddExpr2Field()

Expr2Field

Expression

AddExpr2Expression()

Expr2Expression

In List

AddExpr2List

Expr2List

In Tree

AddExpr2Expression

Expr2Expression

Subquery

AddExpr2Subquery()

Expr2Subquery

Const-Const

Expr2Constant,

Expr2Constant

Expr2Constant,

Expr2Constant

Const-Field

Expr2Constant,

AddExpr2Field()

Expr2Constant,

Expr2Field

Const-Expr

Expr2Constant,

AddExpr2Expression()

Expr2Constant,

Expr2Expression

Field-Const

AddExpr2Field(),

Expr2Constant

Expr2Field,

Expr2Constant

Field-Field

AddExpr2Field(),

AddExpr2Field()

Expr2Field,

Expr2Field

Field-Expr

AddExpr2Field(),

AddExpr2Expression()

Expr2Field,

Expr2Expression

Expr-Const

AddExpr2Expression(),

Expr2Constant

Expr2Expression,

Expr2Constant

Expr-Field

AddExpr2Expression(),

AddExpr2Field()

Expr2Expression,

Expr2Field

Expr-Expr

AddExpr2Expression(),

AddExpr2Expression()

Expr2Expression,

Expr2Expression

Example

The following is used to test the expression to determine the property to use to retrieve it:

&MyExpr2 = &MyCriteria.Expr2Expression; 
 
If &MyExpr2.Expr2Type = %Query_ExprConstant Then /* Expression is a constant */ 
 
   &OldValue = &MyExpr2.Expr2Constant; 
   /* do processing */ 
 
End-if;

The following is an example showing how to add a field for Expression 2:

( )
/* After setting the first expression, set the operator for the criteria*/
&MyCriteria.Operator = %Query_CondEqual;

/* Set the type of the second expression to be a field */
&MyCriteria.Expr2Type = %Query_ExprField;

/* Add the EMPLID field from the ABSENCE_HIST record whose record alias is A */
&MyField = &MyCriteria.AddExpr2Field("A", "EMPLID" );

Description

This property returns or sets the logical portion of a criteria.

Note: This property is valid only when there are more than one criteria for a query. Also, this property is required when there is more than one criteria for a query.

The values are:

Numeric Value

Constant Value

Description

1

%Query_CombAnd

Logical And for non-having criteria

2

%Query_CombOr

Or for non-having criteria

3

%Query_CombNotUsed

No logical operator. Used for the first non-having criteria.

4

%Query_CombHaveAnd

Logical And for having criteria

5

%Query_CombHaveOr

Logical Or for having Criteria

6

%Query_CombHaveNotUsed

No logical operator. Used for the first having criteria.

This property is read/write.

Description

This property returns or sets the left parenthesis level used for grouping criteria. This property takes a numeric value.

This property is read/write.

Description

This property returns the name of the Query Criteria, as a string.

This property is read-only.

Description

This property returns a Boolean value, indicating whether a criterion is negated: True if the criterion is negated, False if it isn't.

This property is read/write.

Description

This property returns or sets the operator for the criteria.

The value of this property determines the valid types of the Expression 2, set with the Expr2Type property.

This property is read/write.

See Expr2Type, Working With Query Criteria and Expressions.

You can use either a constant or numeric value for this property. The values are:

Numeric Value

Constant Value

Description

1

%Query_CondNone

None (used for initializing a new criteria.)

2

%Query_CondEqual

Criteria's left-hand side is equal to right-hand side (= operator)

3

%Query_CondNotEqual

Criteria's left-hand side is not equal to right-hand side (<> operator)

4

%Query_CondGreaterThan

Criteria's left-hand side is greater than right-hand side (> operator)

5

%Query_CondNotGreaterThan

Criteria's left-hand side is not greater than right-hand side (<= operator)

6

%Query_CondLessThan

Criteria's left-hand side is less than right-hand side (< operator)

7

%Query_CondNotLessThan

Criteria's left-hand side is not less than right-hand side (>= operator)

8

%Query_CondInList

Criteria's left-hand side is in the given list (IN operator)

9

%Query_CondNotInList

Criteria's left-hand side is not in the given list (Not IN operator)

10

%Query_CondBetween

Criteria's left-hand side is between the two values of right-hand side (BETWEEN operator)

11

%Query_CondNotBetween

Criteria's left-hand side is not between the two values of right-hand side (BETWEEN operator)

12

%Query_CondExists

Criteria's left-hand side is the output of the subquery of right-hand side (EXISTS operator)

13

%Query_CondNotExists

Criteria's left-hand side doesn't exist in the output of the subquery of right-hand side (NOT EXISTS operator)

14

%Query_CondLike

Criteria's left-hand side is like (wildcard search) the right-hand side (LIKE operation)

15

%Query_CondNotLike

Criteria's left-hand side is not like (wildcard search) the right-hand side (NOT LIKE operation)

16

%Query_CondNull

Criteria's left-hand side is NULL (NULL operation)

17

%Query_CondNotNull

Criteria's left-hand side is not NULL (IS NOT NULL operation)

18

%Query_CondInTree

Criteria's left-hand side is from a list of nodes in Tree (IN operation)

19

%Query_CondNotInTree

Criteria's left-hand side is not from a list of nodes in Tree (NOT IN operation)

20

%Query_CondEffDtLessEqual

Criteria's left-hand side is an Effective Date and is less than or equal to the date on the right-hand side (<= operation)

21

%Query_CondEffDtGreaterEqual

Criteria's left-hand side is an Effective Date and is greater than or equal to the date on the right-hand side (>= operation)

22

%Query_CondEffDtLess

Criteria's left-hand side is an Effective Date and is less than the date on the right-hand side (< operation)

23

%Query_CondEffDtGreater

Criteria's left-hand side is an Effective Date and is greater than the date on the right-hand side (> operation)

24

%Query_CondFirstEffDt

Criteria's left-hand side is the first effective date (Function MIN())

25

%Query_CondLastEffDt

Criteria's left-hand side is the last effective date (Function MAX())

26

%Query_CondInTreeJoin

Criteria's left-hand side is an In Tree Join.

Description

This property returns or sets the expression number for the first expression of Expression 2. This property takes a numeric value.

This property is read/write.

Description

This property returns or sets the expression number for the second expression of Expression 2. This property takes a numeric value.

This property is read/write.

Description

This property returns the expression type for the first expression of Expression 2. This property takes a numeric value and is the same range of values as the Expr2Type. It helps distinguish the type of an expression based on the value of Expr2Type. For instance, if the Expr2Type is Field-Expr, R1Expr2Type is of type Field and R2Expr2Type is of type Expression.

This property is read-only.

Description

This property returns the expression type for the second expression of Expression 2. This property takes a numeric value and is the same range of values as the Expr2Type. It helps distinguish the type of an expression based on the value of Expr2Type. For instance, if the Expr2Type is Field-Expr, R1Expr2Type is of type Field and R2Expr2Type is of type Expression.

This property is read-only.

Description

This property returns or sets the right parenthesis level used for grouping criteria. This property takes a numeric value.

This property is read/write.