Le Comparison Mode
Obsolete
The LEfind 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 LE 10
This is correct:
If (iCount <= 10)
Purpose
To specify "less 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 file.field
find le file.field
See the 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 le operator:
indicate indicator as variable le variable
See the Indicate Command for a description of that command.
if variable le variable command
See the If Command for a description of that command.
repeat command: command until variable le variable
See the Repeat Command for a description of that command.
while variable le variable command: command end
See the 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 less than or equal to the second-named.
What It Does
When used with the find command, le 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 less than the buffer value is used to complete the find. If the index contains no value less than the standard, then the find le will fail.
open TEST
clear TEST
move 1 to test.emp_id
find le test.emp_id
[not found] showln "No record found"
For this example, if the lowest emp_id in the file TEST is 2 (or greater), then the find will fail, setting the Predefined Indicator found to false. The line "No record found" will be printed to the screen.
move "BONAPARZ" to emperors.last_name
find le emperors.last_name
In this example, the value of "BONAPARZ" is moved to the record buffer field last_name for the 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 less than "BONAPARZ," using the main index for that field. The field last_name must be indexed.
When used as a find mode by an index containing one or more segments designated "upper case," le will find a record containing lesser 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 le will actually find ge relative to the record values to produce the desired descending sequence.
When used in comparisons, le 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 reject as income le 4000
[reject] gosub next_one
In this example, the indicator reject is set to true when the value of the variable income is 4000 or less. The second line executes the labeled subroutine next_one when reject is true.
while windowindex le 5
move 0 to form.1&
increment windowindex
loop
In this example, the value of 0 is displayed to windows in image form in ascending order until the fifth window is reached (inclusive). The loop is executed as long as the value of the predefined variable windowindex is less than or equal to 5. Note the increment command, which increments the value of windowindex so that it eventually reaches 5.
Notes
-
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. -
leapplies to strings and dates as well as to numeric values. For strings, "less" means "alphabetically before," and for dates, it means "earlier than," except for index segments designated as descending, where the opposite occurs. -
lemay not be used in logical expressions (comparisons enclosed in parentheses). In expressions,<=is to be used.