Jump to content

JaspeReports scenario - is thispossible/reasonable?


Recommended Posts

Hi everybody,

I am a JasperReports beginner and we are trying to find a suitable solution
to integrate Business Intelligence (reporting) to our own software. I am
having some trouble on how to interact with the actual data coming from a
oracle database as well as from a java object “Record” (getAttribute(...),
getValue(...)). Maybe you can comment if the desired scenario is possible
using jasperreports.

Person A writes a report with probably ireport. In ireport he/she can access
the oracle database and write the report with the actual data BUT he/she
cannot access the java object. Since the java object is not accessible is it
possible to just place dummy parameters which are filled in later?

If this works, the person who wrote the report then compiles the reports and
deploys it to a tomcat instance. After triggering to read/export the report
in our application the parameters will be filled in with the actual data
from the database and the java object and the reports is shown.

I guess this is the desired sequence:

Person writes report and saves jrxml
compileReport compiles the jrxml to .jasper
.jasper is deployed on our production server
if the report is started in our web application fillReport is called and
then the desired export function is called

If this scenario is possible do you have any comments? I still would have to
find a way from the parameters representing the java functions from the java
object record and place all data in a hash map, right?

Thanks a lot

Regards

ke
 

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

meanwhile I have looked at some of the sample scripts and found out that in the webapp demo a function hello() is called from the jrxml file:

((scriptlets.WebappScriptlet)$P{REPORT_SCRIPTLET}).hello()

If this works for me the writer of the report could write out the functions getAttribute() and getValue()... in iReport and place them at the appropriate position and during reportfill those functions get actually called. Am I understanding this correctly? 

Thanks

Link to comment
Share on other sites

sorry if I was not making myself clear. Let me try again:

I want to integrate reporting in our java application. Some of the report data will come from java functions (getAttribute(), getValue(), ...) which are not accessible in iReport when writing the report. When finally triggering to export the report in our java application, the report can access these functions.

So I would like to know how I handle these functions in iReport. In other words: what do I tell the person who writes the reports to place where he normally calls the function getAttribute(String attr_id) to retrieve data. 

Maybe scriptlets are what I need?

Thanks again

Link to comment
Share on other sites

I looked at scriptlets and I dont think this is what I need.

I need to access my java obect "RECORD" in the reports. I guess the easiest way is to use "RECORD.getValue(par1, par2, par3..);" in ireport just like I do in my java app. But is this possible and how do I instantiate the object RECORD.

I am clueless on where to search for a solution. I guess I have to look for a custom datasource but I cant find anything. Please help

Thanks

Link to comment
Share on other sites

I am sorry for all the spamming but I am really having trouble to explain my problem. I would like to try it again.

I want to use my Java Object “Record” as a datasource. But Record again is tied to an oracle database so there is nothing like structured data in this object.

All samples and demos I have looked at access the Objects attributes itself for the data like in here:

public class CustomBean{

private String city = null;
private Integer id = null;
private String name = null;
private String street = null;


In the report city and name and street is used as a data source but in my case the Object itself does not hold the data. It again gathers the data from the oracle database through various functions like: getAttribute(par1,para2…) and getValue(par1,para2…).

I really hope this clarifies the problem. I need to actually dummy call these functions getAttribute(String attr_id) from iReport and then the fillReport process actually calls the “Record” Object functions to place in the real data.

Has this been done before or is there any chance I can do this using JasperReports?

Thanks
 

Link to comment
Share on other sites

Again I got a little bit futher but still problems remain. I am using JavaBeans as a datasource now.

If I have a field called "test123" in my report the function getfield123() is called. This is half way to what I need.

Like I explained before I need to call the function getValue(par1, par2) so is there any chance I can pass parameters to the get method?

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...