From RAD Studio API Documentation
Jump to: navigation, search


property LookupCache: Boolean read FLookupCache write SetLookupCache default False;


__property bool LookupCache = {read=FLookupCache, write=SetLookupCache, default=0};


Type Visibility Source Unit Parent
property published
Data.DB TField


Determines whether the values of a lookup field are cached or looked up dynamically every time the current record in the dataset changes.

Set LookupCache to true to cache the values of a lookup field when the LookupDataSet is unlikely to change and the number of distinct lookup values is small. Caching lookup values can speed performance, because the lookup values for every set of LookupKeyFields values are preloaded when the DataSet is opened. When the current record in the DataSet changes, the field object can locate its Value in the cache, rather than accessing the LookupDataSet. This performance improvement is especially dramatic if the LookupDataSet is on a network where access is slow.

If every record of DataSet has different values for KeyFields, the overhead of locating values in the cache can be greater than any performance benefit provided by the cache. The overhead of locating values in the cache increases with the number of distinct values that can be taken by KeyFields.

If LookupDataSet is volatile, caching lookup values can lead to inaccurate results. Call RefreshLookupList to update the values in the lookup cache. RefreshLookupList regenerates the LookupList property, which contains the value of the LookupResultField for every set of LookupKeyFields values.

When setting LookupCache at runtime, call RefreshLookupList to initialize the cache.

Note: LookupCache is only meaningful if the value of FieldKind is fkLookup.

See Also