Report.Break() Method

Version: Available or changed with runtime version 1.0.

Exits from a loop or a trigger in a data item trigger of a report or XmlPort.

Syntax

 Report.Break()

Parameters

Report
 Type: Report
An instance of the Report data type.

Remarks

BREAK causes the current trigger to end. When used inside a loop, such as a WHILE-DO or REPEAT-UNTIL construction, BREAK interrupts the loop and causes the current trigger to end.

Compare this with the QUIT Method (Report, XMLport).

Note

BREAK still calls remaining triggers for the current record, but the record is omitted from the dataset.

Tip

You can also use the AL BREAK Statement to exit an iteration or loop. The difference is that the BREAK statement does not terminate the trigger. It just exits the loop.

Example

var
    MyVar: Integer;
    Text000: Label "The variable is now %1.";
begin
    MyVar := 0;  
    repeat  
      MyVar := MyVar + 1;  
      if MyVar = 5 then  
        CurrReport.BREAK;  
      Message(Text000,MyVar);  
    until Myvar = 10;  
    Message('After REPEAT-UNTIL loop'); //This statement is never called.  
end;

When you run the previous code, the loop will end when MyVar is 5 and the execution of the current trigger ends. Statements after the loop are not executed.

Report Data Type
Get Started with AL
Developing Extensions