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 4
  • Created
  • Last Reply

Top Posters In This Topic

Hello,

You can use a class called JRCVSDataSource in order to use a java object as a data.Here,we can create the list of the java objects(say,Data Object) & pass this in the constructor of the above class.The variable names present in java object are matched with that of field names.

Hope this helps.

 

 

 

Link to comment
Share on other sites

I have solved this problem now by using a _THIS reference to my javabean. Now I can call any function in that bean with any kind of parameter. This is how I am referencing it:

""+((myBean)$F{_THIS}).getValue("mykey")

I am not sure why iReport needs <""+> in the very front, but without it does not work. _THIS is from type object. Does objects need ""+ maybe I dont know?

thanks

Link to comment
Share on other sites

ok, its good to hear that you got that working.

You may need to look at the jrxml file that is being generated.You will find that there will be a element assoicated with the each field like this....

(1)<field name="FIELD_NAME" class="java.lang.String"/>

& then you will need to check the type of data(2) coming out of your bean.

There might be  a mismatch of class type between (1) and (2).So, you were forced to use " " this in order to match the class ("String" in your case) types.

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...