VirtualDataTable.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
Namespace: FlexCel.Report
public virtual Object Lookup(TLookupFieldDefinition LookupFields, Object[] keyValues, String sort)
Parameters
<-> | Parameter | Type | Description |
---|---|---|---|
LookupFields | TLookupFieldDefinition | Fields used to do the lookup. | |
keyValues | Object[] | A list of the values for the keys, that you should use to locate the right record. | |
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.