CreateSearchCondition(logicalOperator, relation, firstOperand, secondOperand)
Returns the FieldSearchCondition object, which is a record search condition for a table by a specified query field. The field must belong to the Query::Fields collection and must not be the calculated one. A field of external database query can take part in a search condition if the Field::Searchable property returns a constant different from gdbExtDBSearchableUnsearchable.
To specify a search condition, the object has to be placed into the Query::FieldSearchConditions collection. It is impossible to add the FieldSearchCondition object to the Query::FieldSearchConditions collection if a query is based on an SQL statement SELECT.
The order of adding objects to the Query::FieldSearchConditions collection is very important for GDB queries built on joins of GDB tables. At first, you should add search conditions of one GDB table in a join, then all search conditions of other GDB table, and so on. For external database queries, such a restriction is absent.
The logicalOperator argument specifies a logical operator defining a connection between the search condition and the other search conditions in the Query::FieldSearchConditions collection. The logical operator is specified by one of the constants given in the "Logical operators" table. The logicalOperator argument must take the value gdbLogicalNone in the first search condition for every table in a join.
The relation argument specifies a search relation. A relation is specified by one of the constants given in the "Relations in search condition" table.
Possibility to use a relation for fields of external database queries is determined by a constant returned by the Field::Searchable property. You can use fields with any relation if the Field::Searchable property returns gdbExtDBSearchableSearchable. You can use fields only with relations of pattern matching if the Field::Searchable property returns gdbExtDBSearchableLikeOnly. Finally, you can use fields with any relation except relation of pattern matching if the Field::Searchable property returns gdbExtDBSearchableAllExceptLike.
For GDB queries, relations of pattern matching are possible only for fields of types gdbFieldTypeString, gdbFieldTypeDate, gdbFieldTypeTime, gdbFieldTypeTimestamp and gdbFieldTypeOLEObject (see the "Types of Fields" table).
For referenced fields, only relations of existence and comparison (gdbQueryRelEQ, gdbQueryRelNE) are possible. For fields of external database queries, such a restriction is absent.
For fields of type gdbFieldTypeOLEObject, relations of existence check the existence of OLE object rather than existence of OLE object description.
The type of firstOperand and secondOperand values must correspond to the field type. For referenced fields, the value type of the firstOperand argument must correspond to the type of key field in a reference table (rather than the type of the value field in the reference table!).
The firstOperand and secondOperand arguments are not used for relations of existence. The secondOperand argument is used in relations of diapason only.
For relations of matching, the firstOperand argument is a pattern string. The following wildcard characters are possible in the pattern string:
? | any single character |
* | any sequence of zero or more characters (or any value of day, month, year) |
For dates, the pattern string is specified in the 'DD/MM/YYYY' format. Fields DD, MM, YYYY must contain digits or the wildcard * (asterisk).
For time, the pattern string is specified in the 'HH:MM:SS' format (24-hour time format). Fields HH, MM, SS must contain digits or the wildcard * (asterisk).
For a timestamp, the pattern string is specified in the 'DD/MM/YYYY HH:MM:SS' format (24-hour time format). Fields DD, MM, YYYY, HH, MM, SS must contain digits or the wildcard * (asterisk).
For fields of the gdbFieldTypeOLEObject type, the pattern string is matched to a description string of an OLE object.