andrija
-
Posts
4 -
Joined
-
Last visited
Content Type
Profiles
Forum
Events
Featured Visualizations
Knowledge Base
Documentation (PDF Downloads)
Blog
Documentation (Test Area)
Documentation
Dr. Jaspersoft Webinar Series
Security Advisories
Downloads
Posts posted by andrija
-
-
I forgot to add - the line that cuses the problem is the one with JasperFillManager.fillReport.
Also, report uses some images that it gets using getResourceAsStream method.
-
I was using JasperReports 1.2.8. When I change classpath in my application to JasperReports 2.0.3, and try to run the report, I get following errors (in 2. popup windows):
The applet is trying to invoke java/lang/System.getProperty() operation on user.dir
The applet is trying to invoke java/lang/System.getProperty() operation on class.path
Both popup windows have buttons Allow, Disallow and Stop applet. No matther what I click, the report is displayed correctly. And this only happens first time when I start the report.
This is the code that I use:
Code:
JasperPrint jasperPrint;
ClassLoader c1 = this.getClass().getClassLoader();
Map parameters = new HashMap();
parameters.put("ID", id);
jasperPrint = JasperFillManager.fillReport(c1.getResourceAsStream("rep.jasper"«»), parameters, getCurrentConnection());
JasperViewer.viewReport(jasperPrint, false);What am I doing wrong?
-
There is a way of working this out, and it can all be done in Oracle database (which means that it works for any reporting tool). It's a bit complicated, but it works:
1. Create a PL/SQL package in Oracle:
create package pk_Report as
--these are the fields that are the output of the
--query
TYPE OUTREC_TYPE IS RECORD (
field1 VARCHAR2(10),
field2 number(10),
field3 date);
TYPE OUTRECSET IS TABLE OF OUTREC_TYPE;
FUNCTION F_report(inParam1 varchar2, inParam2 varchar2) RETURN OUTRECSET PIPELINED;
end;
create package body pk_Report as
--this is the procedure that we'd like to call
--before the query
procedure before_report is
--following line is necessary if you want to do some inserts, updates or deletes
pragma autonomous_transaction;
begin
--do some DDL here....
null;
end;
FUNCTION F_report(inParam1 varchar2, inParam2 varchar2) RETURN OUTRECSET PIPELINED
is
temp outrec_type;
begin
--this is where we call before_report procedure
before_report;
--this is the query from the report:
for c in (select field1, field2, field3 from some_table where fied4=inParam1 and field5=inParam2) loop
temp.field1:=c.field1;
temp.field2:=c.field2;
temp.field3:=c.field3;
pipe row(temp);
end loop;
end;
end;
2. When you call your procedure from Jasper, do it like this:
select * from table(pk_report.f_report('a,'b'))
And that's it.
"The applet is trying to invoke.." in swing app.
in Products
Posted