TableFindNearest |
Top Previous Next |
Prototype
TableFindNearest(intTableHandle,strFieldValue)
Description
Makes a search on the index currently selected inside the table and it places itself on the record having the field value quite similar to the one to be searched for, even if it has to be greater than itself.
Parameters
IntTableHandle: integer value corresponding to the table handle.
StrFieldValue: string corresponding to the field value.
Returned value
None.
Notes
None.
Example
// Opens a table TableOne:=TableOpenBDE('c:\invoices\index','invoices.db');
// Order the table according to a field TableSetIndex(TableOne,'Fiscal Code');
// Store the index 1 field data FieldValue:='Smith';
// Search for data within the table and places itself on the record TableFindNearest(TableOne,FieldValue);
// Store the table field value into a variable FoundValue:=TableGetFieldByName(TableOne,'Fiscal Code');
// If the table value is different than the field one then… If FoundValue<>FieldValue Then Begin
// Set the table insert mode TableInsert(TableOne);
// Store the field value in a new record TableSetFieldByName(TableOne,'Fiscal Code',FieldValue);
// Confirm the table change TablePost(TableOne); End;
// Close the table TableClose(TableOne);
|