Export (0) Print
Expand All
0 out of 2 rated this helpful - Rate this topic

BREAK Function (Dataport, Report, XMLport)

Microsoft Dynamics Nav 2009

Exits from a loop or a trigger in a data item trigger of a dataport, report, or XMLport.


BREAK

When used inside a loop, such as a WHILE-DO or REPEAT-UNTIL construction, BREAK interrupts the loop. Execution continues with the statement that immediately follows the loop.

When used outside a loop, BREAK causes the current trigger to end.

Compare this with the QUIT Function (Dataport, Report, XMLport).

This example of code in a report object requires that you create the following variable and text constant in the C/AL Globals window.

Variable name DataType

MyVar

Integer

Text constant ENU value

Text000

The variable is now %1.

REPEAT
  MyVar := MyVar + 1;
  IF MyVar = 5 THEN
    CurrReport.BREAK;
  MESSAGE(Text000,MyVar);
UNTIL Myvar = 10

When you run the preceding code, the loop will end when MyVar is 5.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.