Eq Comparison Mode
Obsolete
The EQfind mode is still supported. Refer to the Find Command for further details.
For Boolean comparisons, you should use the = symbol inside a Boolean expression.
Example
This is obsolete:
If iCount EQ 10
This is correct:
If (iCount = 10)
Purpose
To specify equality or exact match as the operator for finds and comparisons.
Syntax
Commands and loops can be controlled according to the result of comparison of two values using the eq operator:
indicate
indicator
as
variable
eq
variable
See Indicate Command for a description of that command.
if
variable
eq
variable command
See If Command for a description of that command.
With the find command, records can be found in a database file according to the result of comparison of a value in the record buffer with values in an index to field values in a database file:
move
value
to
df_filename.field
find eq
df_filename.field
See Find Command for a description of that command.
What It Does
Eq returns a result of true when the numeric values of two variables are numerically equal, or when the strings they contain are identical.
indicate senior as years eq 4
This example sets Indicator senior true if the (numeric or string) value of Variable years is 4. If the value of years is other than 4, senior is set false.
if years eq 4 indicate senior true
Like the preceding example, this command sets Indicator senior true if the (string or numeric) value of Variable years is 4. If the value of years is other than 4, however, senior remains unchanged from its status before the command was executed.
move 4 to customer.num
find eq customer.num
In this example, the value of 4 is moved to record buffer Field num for Database File customer after customer has been opened and its record buffer cleared. The subsequent find command finds the record in customer whose num field is equal to 4, using the main index for Field num, which must be a unique index.
When used as a find mode by an index containing one or more segments designated "upper case," eq will find a record containing the same letters in the same order as the search key regardless of capitalization in either the record field or the search key.
Notes
-
For the
indicateandifcommands, DataFlex uses eight Comparison Mode operators:eq,ge,gt,in,le,lt,ne, andmatch. -
For
findcommands, DataFlex uses five Find Mode operators:eq,ge,gt,le,lt. -
Find eqcommands may only be used with unique indexes. If they are used with non-unique indexes, they will never find a record. -
Eqmay not be used in logical expressions (comparisons enclosed in parentheses). In expressions, the equals sign (=) is to be used.