we will write some code to use in any Jasper report report
first, create a procedure
create or replace PROCEDURE GET_REPORT_F (p_file_name VARCHAR2 ,p_file_type VARCHAR2 ,p_paramter_name VARCHAR2 ,p_paramter_value VARCHAR2 )
IS
v_blob BLOB;
v_file_name VARCHAR2 (25) := p_file_name||'.'||p_file_type;
v_vcContentDisposition VARCHAR2 (25) := 'inline';
v_hostname VARCHAR2(30) := 'localhost'; -- your hostname, eg: localhost
v_port NUMBER := '8081'; -- port for your JasperReports Server, eg: 8081
v_username VARCHAR2(50) := 'jasperadmin'; -- jasperreports server username
v_password VARCHAR2(50) := 'jasperadmin'; -- jaspereports server password
v_jasper_string VARCHAR2(30) := v_username || ';' || v_password;
v_login_url VARCHAR2(100) :=
'http://' || v_hostname || ':' || v_port || '/jasperserver/rest/login';
-- modify below URL before use!
-- you should modify the line below; change /Pretius/ to your own name
-- before you add a line try your URL in a web browser
v_report_url VARCHAR2(100) :=
'http://' || v_hostname || ':' || v_port || '/jasperserver/rest_v2/reports/reports/ALI/' || v_file_name;
BEGIN
-- log into jasper server
v_blob := apex_web_service.make_rest_request_b(
p_url => v_login_url,
p_http_method => 'GET',
p_parm_name => apex_util.string_to_table('j_username;j_password',';'),
p_parm_value => apex_util.string_to_table(v_jasper_string,';')
);
-- download file
v_blob := apex_web_service.make_rest_request_b(
p_url => v_report_url,
p_http_method => 'GET',
p_parm_name => apex_util.string_to_table(p_paramter_name,';'),
p_parm_value => apex_util.string_to_table(p_paramter_value,';')
);
owa_util.mime_header('application/PDF',false);
htp.p('Content-Length: ' || dbms_lob.getlength(v_blob));
owa_util.http_header_close;
wpg_docload.download_file(v_blob);
EXCEPTION
WHEN OTHERS THEN
RAISE;
END;
second, Create 4 Application Item
third, make report on emp table
create a link on a column to pass the parameter
create a page to display the report in an iframe
create process [pefore header ]
DECLARE
l_url varchar2(2000);
l_app number := v('APP_ID');
l_session number := v('APP_SESSION');
V_FILE_NAME varchar2(200) := :APP_FILE_NAME;
V_FILE_TYPE varchar2(200) := :APP_FILE_TYPE;
V_PARM_NAME varchar2(200) := :APP_PARM_NAME;
V_PARM_VALUE varchar2(200) := :APP_PARM_VALUE;
BEGIN
:P2_URL2 := APEX_UTIL.PREPARE_URL(
p_url => 'f?p=' || l_app || ':0:'||l_session||':APPLICATION_PROCESS=REPORT_PROCESS_F:NO::APP_FILE_NAME,APP_FILE_TYPE,APP_PARM_NAME,APP_PARM_VALUE:'||V_FILE_NAME||',' ||V_FILE_TYPE||','||V_PARM_NAME||','||V_PARM_VALUE );
END;
create a region for iframe
<p align="center">
<iframe src="&P2_URL2." width="99%" height="1000">
</iframe>
</p>
you will get a report
thanks