AMT Help Files

Included Reports

Insertables are used to add the same functionality to multiple forms or reports in an easy and efficient way. They are physically inserted into the objects when the application is compiled.

Insertable forms/ reports are pieces of the layout that are displayed in forms or reports. Within such an insertable, a layout is defined that can be called from any form or report to which that insertable is added. Within the forms or reports, the insertable appears for instance as the header or footer for that object. For the end user, the form and inserted form appear just as one form.

Insertable global routines are used to add functionality to forms that is not related to the layout. Because they are physically a part of the object, they can also use local variables.

Creating and adjusting an insertable

An insertable is created and adjusted pretty much the same way as other objects. However, within an insertable form there are no routines. If an insertable form or report is updated, all the forms or reports that inherit functionality from the insertable will also be updated automatically. In contradiction with normal forms and global routines, these objects contain no routines if they are defined as insertables.

It is important to choose names that are not used inside the layout of the forms or reports to which the insertable will be included, otherwise you would get validation errors. The names of the print layouts themselves can be identical, in which case both the print layout of the report and the inserted layout will be combined when printing.

Choose one of the following links for more information:

Inserting a layout to your form or report

Insertable forms or reports can be added to a form or report as follows:

The inserted object will be added to the folder "included forms" or "included reports":

For an insertable report a routine call to the insertable report will be added at the start of the Main routine (e.g. ins_report () ). When generating the report this call to the insertable report will be handled in exactly the same way as an Insertable Global Routine. I.e. the inline code of the insertable report will first be added to the report at the place of the routine call and then generation will take place.
When the inline code needs to be executed at another place then the start of the Main routine, you have to move the routine call to that place. And exactly as with Instertable Global Routines multiple calls to the insertable report are allowed.

You can remove an insertable from the folder "Included forms" or "Included reports" by right-clicking on the insertable and choosing "Delete".
When removing you also have to remove the insertable from the code, because otherwise upon syntaxchecking (F7) it will place the insertable back.

Inserting a routine in your form or report

If you specify an insertable global routine in a routine of a form or report, the specified routine is called from that object and performed when the specification is encountered during the program execution. An inserted global routine is called the same way as other routines that were created in the form or report itself.

e.g. in a routine the global insertable "GLI-NXT-PRE" is specified as follows:

gli-nxt-pre ()


When calling an insertable global routine from a single routine (in a form or report) more than once, the calling routine may not contain any label that is defined inside the insertable. This is not permitted because the insertable will be physically part of the called object and because of that the labels would occur in that object more than once. So, an "external call" in such a case would lead to indistinct behavior.

Example:

Below, the code for an insertable global routine called "TEST":

if ga-4 = 'SKIP'
    goto (einde)
endif

if
 gn-6 = 12
    gn-6 := 4
endif

:einde

Below, the code for an exemplary form ("DEMO") that calls the insertable:

routine display_main
begin_routine // GOTO (EINDE) is not allowed as TEST is used twice

    gn-6 := 12
    test ()
    gn-6 := 14
    test ()

end_routine

routine process_main
begin_routine

    goto (einde// is allowed as TEST is used only once
    gn-6 := 12
    test ()

end_routine