Search Results for

    Show / Hide Table of Contents

    TVirtualDataTable.Lookup Method

    Looks for a key on this dataset and returns the corresponding value. Note: Remember that VirtualDataSet is stateless, so if you use any caching here, make sure you appropiately lock() this method so there is no possibility of one thread reading the cache when the other is updating it.

    Remarks

    You do not need to implement this method unless you want to provide an optimized routine. There is a default implementation which will look at all the records, cache them in a hash table, and use that for lookup. This default implementation should be enough in most cases.

    Syntax

    Unit: FlexCel.Report

    function TVirtualDataTable.Lookup(const LookupFields: TLookupFieldDefinition; const keyValues: TArray<TCellValue>; const sort: string): TReportValue; virtual;

    Parameters

    <-> Parameter Type Description
    const LookupFields TLookupField​Definition Fields used to do the lookup.
    const keyValues TArray<TCellValue> A list of the values for the keys, that you should use to locate the right record.
    const sort string How the data is sorted. This is relevant for TOP tables where not all data is available.

    Returns

    The value at "column" , for the record where the columns on "keyNames" have the "keyValues" values. If there is more than one record where "keyNames" is equal to "keyValues" you might opt to throw an Exception or just return any of the valid values, depending on the behavior you want for lookup.

    See also

    • TVirtualDataTable
    In This Article
    Back to top FlexCel Studio for VCL and FireMonkey v7.24
    © 2002 - 2025 tmssoftware.com