The pre-report trigger is a PL/SQL stored procedure that is called up before the execution of the actual report. The post-report trigger is a PL/SQL stored procedure that is called after the actual implementation of the report.
These stored procedures are performed in a package. This package requires the name of the report, followed by ‘_rpt’, for example ‘bubs_custom01_rpt’. The procedure pre_report is performed as pre-report trigger and the procedure post_report as post-report trigger.
An example of such a package is:
create or replace package bubs_custom01_rpt
as
/*
*
* $Header: http://svn.invantive.com/repos/p104/trunk/help/nl/manual/Topics/rap-bouwen-pre-report-trigger.xml 19891 2012-10-09 13:23:03Z gle3 $
*
* (C) Copyright 2004-2009 Invantive Software BV, the Netherlands. All rights reserved..
*
*/
procedure pre_report
( p_functie bubs_functies_v.fte_code%type
)
;
procedure post_report
( p_functie bubs_functies_v.fte_code%type
)
;
--
-- Return the version ID of CVS for the package.
--
function get_version_id
return varchar2
;
end;
/
grant execute on bubs_custom01_rpt to &&bubs_user_role
/
create or replace package body bubs_custom01_rpt
as
/*
*
* $Header: http://svn.invantive.com/repos/p104/trunk/help/nl/manual/Topics/rap-bouwen-pre-report-trigger.xml 19891 2012-10-09 13:23:03Z gle3 $
*
* (C) Copyright 2004-2009 Invantive Software BV, the Netherlands. All rights reserved..
*
*/
procedure pre_report
( p_functie bubs_functies_v.fte_code%type
)
as
begin
null;
end
;
procedure post_report
( p_functie bubs_functies_v.fte_code%type
)
as
begin
null;
end
;
--
-- Return the version ID of CVS for the package.
--
function get_version_id
return varchar2
as
begin
return '$Header: http://svn.invantive.com/repos/p104/trunk/help/nl/manual/Topics/rap-bouwen-pre-report-trigger.xml 19891 2012-10-09 13:23:03Z gle3 $';
end;
end;
/
The pre-report trigger can be used to improve performance by preparing and storing common data in a temporary table or to feed the report with different data, depending on the settings of the user. For example, the following pre-report trigger is used to fill a report with data of the current situation if that is possible and with historical data if such is requested:
--
-- Delete possible remaining data from a previous report on the same connection.
--
delete bubs_fdt_t
;
commit
;
if bubs_session.get_session_reporting_date is null
then
--
-- Current situation requested.
--
insert into bubs_fdt_t
select * from bubs_fdt_r
;
commit
;
else
--
-- Historical situation requested.
-- Somewhat slower.
--
insert into bubs_fdt_t
select * from bubspfdt_r
;
commit
;
end if;
The post-report trigger is then:
delete bubs_fdt_t
;
commit
;
For example, it is also possible to highlight in the pre-report trigger the information that needs to be printed and to highlight them in the post-report trigger as being ‘reported’.
Normally the post-report trigger is only used to remove temporary data.