Lt Comparison Mode
Obsolete
The LTfind 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 LT 10
This is correct:
If (iCount < 10)
Purpose
To specify "less than" 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 the database file:
move value to file.field
find lt 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 lt operator:
indicate indicator as variable lt variable
See the Indicate Command for a description of that command.
if variable lt variable command
See the If Command for a description of that command.
repeat command: command until variable lt variable
See the Repeat Command for a description of that command.
while variable lt 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 the second-named.
What It Does
When used with the find command, lt 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. 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 is considered unsuccessful, and the predefined indicator found is set to false.
move "BONAPARZ" to emperors.last_name
find lt emperors.last_name
In this example, the value of BONAPARZ 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 less than BONAPARZ, 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," lt will find a record containing lesser letter value regardless of capitalization in either the record field or the search key. If one or more segments is designated "descending," find lt will actually find gt relative to the record values to produce the desired descending sequence.
When used in comparisons, lt 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 less than the standard.
indicate reject as income lt 4000
[reject] gosub next_one
In this example, indicator reject is set true when the value of variable income is less than 4000. The second line executes labeled subroutine next_one when reject is true.
while windowindex lt 5
display 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. The loop is executed as long as the value of predefined variable windowindex is less than 5. Note the increment command, which increments the value of windowindex so that it does eventually reach 5.
Notes
-
Find
ltcommands in a loop will "step through" a database file record by record in descending order by the index in use from the index value of whatever record is in the buffer at the time the loop is started. This is useful for record-by-record reports and will start at the end of the index if the loop is started when the record buffer is clear. -
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. -
ltapplies 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 descending, where the opposite occurs. -
ltmay not be used in expressions (comparisons enclosed in parentheses). In expressions,<is to be used.