Jump to content
Changes to the Jaspersoft community edition download ×

passing Userdefined Objects in jasperreports

Recommended Posts

By: roshansalvi - roshansalvi

passing Userdefined Objects in jasperreports

2005-03-01 00:18

hello everyone!

i m generating reports using Jasper Reports and using iReport as visula editor,

i m also passing parameters, all works well


but i don't know how to pass a Object of a Userdefined class

(i have build a class Employee with salary-double and name-string)

i want to pass object of class Employee to Jasper Report and display values of name and salary....

is it possible...if yes the how?

plz help me out


Thank You



By: Jeff Erlandsson - theace

RE: passing Userdefined Objects in jasperrepo

2005-03-01 07:13

It is afaik possible by passing the Object in as a parameter (or field) and in the expression cast it to the correct class.


e.g. ((Employee)$P{EmployeeObject}).getName()


On a side note, what I'd really like is the possibility to easily use bean properties, instead of casting custom objects in expressions or defining all parameters and fields.


Also, being able to use more than one detail field (as opposed to using subreports) would in my opinion greatly improve the ease of use of JR.



By: Jeff Erlandsson - theace

RE: passing Userdefined Objects in jasperrepo

2005-03-01 07:38

Ah, never mind that side note. I completely forgot that it is entirely possible to use bean properties by using reflection in the data source or similar approach. I am too stuck in the legacy framework I have to use for JRDatasources...


But multiple detail fields would rock, instead of using subreports or flattening the data.


Also (I just keep going on...), it would be quite nice to be able to 'float' fields horizontally, not just vertically. This could help alot in dealing with dynamic reports. Of course, one could always generate the report (or edit it) using the API.


Anyway, I'd like to thank Teodor for a great open source solution. =)

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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