LocateEx with lxNearest problem with dates
-
NoComprende
- Posts: 135
- Joined: Tue 09 Jan 2007 13:44
-
NoComprende
- Posts: 135
- Joined: Tue 09 Jan 2007 13:44
Dimon, going back to the lxNearest problem. In the CodeGear help for TTable FindNearest it states
FindNearest positions the cursor either on a record that exactly matches the search criteria, or on the first record whose values are greater than those specified in the search criteria. If there are no records that match or exceed the specified criteria, FindNearest positions the cursor on the last record in the table
Just to let you know that, if you search for a value that falls beyond the end of the table then LocateEx with TLocateExOptions set to lxNearest does not go to the last record.
FindNearest positions the cursor either on a record that exactly matches the search criteria, or on the first record whose values are greater than those specified in the search criteria. If there are no records that match or exceed the specified criteria, FindNearest positions the cursor on the last record in the table
Just to let you know that, if you search for a value that falls beyond the end of the table then LocateEx with TLocateExOptions set to lxNearest does not go to the last record.
In MyDAC help said:
lxNearest - LocateEx moves the cursor to a specific record in a dataset or to the first record in the dataset that is greater than the values specified in the KeyValues parameter. For this option to work correctly dataset should be sorted by the fields the search is performed in. If dataset is not sorted, the function may return a line that is not connected with the search condition.
-
NoComprende
- Posts: 135
- Joined: Tue 09 Jan 2007 13:44
OK Dimon, MyDAC help doesn't state it will move to the end of the table if the search value is greater than the last record but don't you think it should for consistency? If I'm searching on a string field (where the current record's value for this field is "AA") and I enter 'ZZ' as the search string, in what way is "AA" the 'nearest' when the last record alphabetically is "ZAK"?