---
url: >-
  /statelake/scripting-reference/events/record-level-events/beforemap-event-record-level.md
---

# BeforeMap Event (Record-level)

The **BeforeMap Event** on the dataset has a special purpose. It allows you to skip the processing of records that you do not want to process - this can be set at any level. If set a header level, then no child or lower level records will be processed.

This **Event** fires once before each record is processed.

If **LinkedData** is set, then multiple records could be processed and this **Event** will fire once before each of those records.

However if **LinkedData** is not set, then this will only fire once.

The **BeforeMap Event** has one parameter called **Value**, which determines whether the record is processed or not. This parameter defaults to **True** but can manually be set to either **True** or **False**. Set the parameter to **False** to skip the record.

If this parameter is set to **True** then the fields in the record will be processed.

The value of this parameter is passed into the **AfterMap** event script if there is one set.

## Setting The BeforeMap Event

Within the script you can perform some checks as to whether you want to process the record and set the parameter **Value** appropriately.

If you do not specify a script for the **BeforeMap Event** then the parameter defaults to **True** and the record will be processed.

In the following example, the value is being set to **False**, meaning that the record will be skipped over.

```pascal
procedure BeforeMapEvent(var Value:Variant);  //ORDER_HEADER
begin
  Value := False;
end;
```

During the **BeforeMap Event** the record in the dataset is not yet open for setting individual field values because the record may be cancelled if the parameter is set to **False**.

A successful **BeforeMap Event** will display in the Map as **green**. A failed **BeforeMap Event** will display in the **Map** as **red**.
