Jump to content
We've recently updated our Privacy Statement, available here ×

DataSource with related Objects?


luke2000

Recommended Posts

Dear Community,

i have to implement reports in my application, therefore the app provides a set of id's which shall be used in the report.

In the docs i found how to implement a DataSource, so passing the first entries to the report should be fine.

jasperreports-6.7.0demosamplesdatasourcesrc

The next step would be to provide related Objects. Within the Report, I need to retrieve related objects from my DataSource.

NOTE: related objects might be direct attributes from the Object provided by the DataSource or via dedicated methods.

// this method returns a direct attribute (can be another object/entity)Object getFieldValue(JRField field)// this method returns related Multimedia for the Object with id Object getRelatedMultimedia(Object id) [/code]

Therefore the DataSource will implement further methods to gain those Objects.

Unfortunately i did not find a sample how to do this. I am willing to work out an simple example, if someone can lead me through how to do so.

EDIT: if possible its also fine to specify a query to gain the related data - then no DataSource for the subreport would be required - just needs to pass the id of the Object for the subreport and its Table name / Class name

Thanks in Advance!

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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