ROUTINE FINALIZE
Syntax
![]()
Command
Mandatory parameter Optional parameter Mandatory keyword Optional keyword |
ROUTINE <Routinename> (<Variable> : string) FINALIZE
BEGIN_ROUTINE
<Code>
END_ROUTINE
Description
Form and Reports can have a finalize routine. This routine will always be executed just before the report ends and does not have to be called from the code.
Diagram
Returned value type
None
Parameters
Parameter | Description |
<Routinename> |
A free to choose name for the routine that will be finalized. |
<Variable> |
When the form or report ends normally the routine will be called with an empty string. When the form or report ends with an exception, the exception message will be passed to this parameter. |
Remarks
The routine may not return a result and should contain one parameter of type String.
This routine is normally used for last minute actions, and should only be used in the main form or report (not in insertables, globals, etc). In Forms the finalize routine will be called after both display_main and process_main events.
Example
routine cleanup (cleanupstring : string) finalize
begin_routine
if cleanupstring <> ''
sme ('The report ended with an exception')
sme ('The execption message is: ' + cleanupstring)
else
resultsend ()
endif
if fc.fileexists ('C:\TEMP\TESTFILES\testfile.txt')
fc.removedir ('C:\TEMP\TESTFILES\testfile.txt')
endif
end_routine
begin_routine
if cleanupstring <> ''
sme ('The report ended with an exception')
sme ('The execption message is: ' + cleanupstring)
else
resultsend ()
endif
if fc.fileexists ('C:\TEMP\TESTFILES\testfile.txt')
fc.removedir ('C:\TEMP\TESTFILES\testfile.txt')
endif
end_routine