Sign in Join
Wiki copytemporary

lookup: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: lookup

OldNewLine
1+## Definition
2+
3+Unit: FreePascal, unit **db**
4+
5+``` pascal
6+ function Lookup(const KeyFields: string; const KeyValues: Variant; const ResultFields: string): Variant;
7+```
8+
9+Official documentation: none
10+
11+## Description
12+
13+**lookup** is similar to [[locate]] in that it looks for a record in the dataset where the specified search values for the specified fields match.
14+
15+If found, the function returns a variant array with the values of the ResultFields (a semicolon-delimited list of desired fields). If not found, it returns **Null**. In neither case does it change the current physical record/cursor.
16+
17+KeyFields can be a single field name or a semicolon-separated list of fields.
18+
19+KeyValue can be a variant or a variant array and the number of items must match the number of fields specified in KeyFields.
20+
21+> **Note:** Lookup is only implemented in non-unidirectional datasets, i.e. you must be able to move back and forwards through the dataset.
22+
23+## See also
24+
25+- [[locate]]
26+- [Description of how to use lookup with Delphi](http://delphi.about.com/od/database/l/aa052901a.htm)
27+
28+---
29+*From the Free Pascal wiki, page "lookup", as it stood on 2020-02-19 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history