Editar

Compartir a través de


OnBeforeOpen (Query) trigger

Version: Available or changed with runtime version 1.0.

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

Syntax

trigger OnBeforeOpen()
begin
    ...
end;

Remarks

The 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 methods from the triggers that run the query, such as Open, SaveAsXml, Read, or Close methods.

Example

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

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

Get Started with AL
Developing Extensions