Share via


OnBeforeOpen Trigger

Executed before a query is run and the dataset is generated.

Syntax

OnBeforeOpen()  

Remarks

The C/AL code of a query object includes the OnBeforeOpen trigger that you can use to change the data that will be included in the resulting dataset. For example, you can use the OnBeforeOpen trigger to apply filters to a column.

The OnBeforeOpen trigger only supports local variables; global variables are not supported.

Note

A query cannot be run from the OnBeforeOpen trigger. You cannot call functions from the triggers that run the query, such as OPEN, SAVEASXML, READ, or CLOSE functions.

Example

The following code applies a filter on the Quantity column of the query by calling the SETFILTER function on the OnBeforeOpen trigger of the query object.

currQuery.SETFILTER(Quantity, '>50');  

See Also

Queries
Working with Queries in C/AL
Queries