CreateLookup(LookupFields: String): ICachedDatasetLookup;
LookupFields is the list of fields by values of which search is performed.
The CreateLookup method creates an object that searches values in data source cache. The list of fields is passed by the LookupFields parameter. Fields in the list are separated with semicolon.
Sub UserProc;
Var
Cache: ICachedDataSet;
CacheField: IDatasetInstanceFields;
LookCache: ICachedDatasetLookup;
s: String;
Begin
Cache := UiTable1.CachedDataset;
LookCache := Cache.CreateLookup("Field;Field1");
CacheField := LookCache.Fields;
CacheField.Item(0).Value := EditBox1.Text;
CacheField.Item(1).Value := EditBox2.Text;
If LookCache.Locate Then
s := LookCache.Lookup("Num1").Item(0).Value As String;
Else
s := "Not found";
End If;
End Sub UserProc;
After executing the example, on pressing the button, the search by cache of the table, set as data source for the UiTable1 component, is performed. Search is performed between two table fields, that are Field and Field1. The searched data is contained in the EditBox1 and EditBox2 components. In case of successful search the "s" variable contains the current value of the Num1 field of the table, otherwise the variable contains the Not Found value.
See also: