Skip to main content
Version: 20 R7 BETA

Level

Level : Integer

ParameterTypeDescription
Function resultIntegerCurrent break or header level

This command is not thread-safe, it cannot be used in preemptive code.

Description

Level is used to determine the current header or break level. It returns the level number during the On Header and On Printing Break events.

Level 0 is the last level to be printed and is appropriate for printing a grand total. Level returns 1 when 4D prints a break on the first sorted field, 2 when 4D prints a break on the second sorted field, and so on.

Example

This example is a template for a form method. It shows each of the possible events that can occur while a summary report uses a form as an output form. Level is called when a header or a break is printed:

  // Method of a form being used as output form for a summary report
 $vpFormTable:=Current form table
 Case of
  // ...
    :(FORM Event=On Header)
  // A header area is about to be printed
       Case of
          :(Before selection($vpFormTable->))
  // Code for the first break header goes here
          :(Level=1)
  // Code for a break header level 1 goes here
          :(Level=2)
  // Code for a break header level 2 goes here
  // ...
       End case
    :(FORM Event=On Printing Detail)
  // A record is about to be printed
  // Code for each record goes here
    :(FORM Event=On Printing Break)
  // A break area is about to be printed
       Case of
          :(Level=0)
  // Code for a break level 0 goes here
          :(Level=1)
  // Code for a break level 1 goes here
  // ...
       End case
    :(FORM Event=On Printing Footer)
       If(End selection($vpFormTable->))
  // Code for the last footer goes here
       Else
  // Code for a footer goes here
       End if
 End case

See also

ACCUMULATE
BREAK LEVEL
Form event code
PRINT SELECTION