Ge Comparison Mode
Obsolete
The GEfind 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 GE 10
This is correct:
If (iCount >= 10)
Purpose
To specify "greater than or equal to" as the operator for finds and comparisons.
Syntax
With the find command, records can be found in a database file according to the results of comparisons 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 ge df_filename.field
See Find Command for a description of that command.
Commands and loops can be controlled according to the results of comparisons of the values of two variables using the ge operator:
indicate indicator as variable ge variable
See Indicate Command for a description of that command.
if variable ge variable command
See If Command for a description of that command.
repeat command: command until variable ge variable
See Repeat Command for a description of that command.
while variable ge variable command: command
end
See While Command for a description of that command.
The values of variables are compared in the order in which they are given in the command "sentence." That is, the first-named variable is tested for being greater than or equal to the second-named.
What It Does
When used with the find command, ge searches for a value in the index to the database file equal to the value in the fields in the record buffer of which the index is composed. If no such value is found, then the value in the index next greater than the buffer value is used to complete the find. If the index contains no value greater than the standard, then the greatest value in the index is used to complete the find.
move "BONAPAR" to emperors.last_name
find ge emperors.last_name
In this example, the value of "BONAPAR" is moved to record buffer Field last_name for Database File emperors after emperors has been opened and its record buffer cleared. The subsequent find command finds the first record in emperors whose last_name field is equal to or greater than "BONAPAR," using the main index for that field. Field last_name must be indexed.
When used as a find mode by an index containing one or more segments designated "upper case," ge will find a record containing greater or equal letter value regardless of capitalization in either the record field or the search key. If one or more segments are designated "descending," find ge will actually find le relative to the record values to produce the desired descending sequence.
When used in comparisons, ge converts the type of the "standard" variable to the same type as the first-named variable and executes the controlled command according to whether the first-named variable is at least equal to the standard.
indicate prospect as income ge 4000
[prospect] gosub mail_adv
In this example, Indicator prospect is set true when the value of Variable income is 4000 or more. The second line executes Labelled Subroutine mail_adv when prospect is true.
while windowindex ge 0
move 0 to form.5&
calc (windowindex - 1) to windowindex
loop
In this example, the value of 0 is displayed to windows in Image form in descending order until the first window is reached (inclusive). The loop is executed so long as the value of Predefined Variable windowindex is greater than or equal to zero. Note the calc command, which decrements the value of windowindex so that it does eventually reach zero.
Notes
-
gealways finds a record unless the file is empty. A findgeeven after the last record in the file will still return the last record. It always sets the Predefined Indicatorsfoundtrue, andfinderrfalse. Note that this behavior is different than forle. A findlebefore the first record in the file will not return a record, and will set the Predefined Indicatorsfinderrtrue, andfoundfalse. -
For the
if,indicate,until, andwhilecommands, DataFlex uses eight Comparison Mode operators:eq,ge,gt,in,le,lt,ne, andmatch. -
For the
findcommand, DataFlex uses five Find Mode operators:eq,ge,gt,le,lt. -
geapplies to strings and dates as well as to numeric values. For strings, "greater" means "alphabetically after," and for dates, it means "later than," except for index segments designated "descending," where the opposite occurs. -
gemay not be used in logical expressions (comparisons enclosed in parentheses). In expressions,>=is to be used.