---
url: /statelake/scripting-reference/classes/dataset-class-tdataset/tdataset.find.md
---

# TDataset.Find

Searches the dataset for a record where the **KeyField** contains the **KeyValue** value.

If found, then the record is made the active record and **True** is returned. The found record becomes the active record.

Otherwise, **False** is returned.

You can then reference that record's field values through the Field objects.

**Declaration**: function Find(KeyField, KeyValue : string) : boolean

Remember, that \<DatasetName> in this example is a placeholder, and simply refers to the actual name of your data set as per your **Map** or custom script.

```pascal
procedure OnMapEvent(var Value:Variant);
begin
 //Searches for a record where Field1 = 123
 if <DatasetName>.Find('Field1', '123') then
  LogInfo('Record found where Field1 equals 123');
end;
```
