views:

2232

answers:

2

I now have my jasper reports working from my JRBeancollectionDataSource in my code! I am just a bit confused about some things...

When I am designing reports in iReport, I create the fields from a query, which I can do fine and all, since when I am actually running the query I'm using a a code JRBeanCollectionDataSource and so is the hql in the report totally irrelevant at this point?

Also, I have List collections of other persistent objects in the ones I'm fetching for the report and I want a subreport that can list the elements of the list, but I don't understand how to reference those from inside iReport to have it make sense when I'm in the code. Can I just refer from one field to another? ie, a field called properties and the subresport referencing that field directly as properties.value?

Help is so appreciated, I'm just kinda stumped... thank you! Joshua

A: 

I have not done jasper reports for a while but for templates with JRDataSources you dont use any sql hql in the reports and example is

http://jasperforge.org/uploads/publish/jasperreportswebsite/trunk/samples/DataSourceReport.jrxml

u pass in the datasource at the filling part of the execution

ssmithstone
So can I just declare fields that match any of the properties of the Objects I plan to pass this at filling time? I am using iReport to design the reports. And most of my objects have Lists in them. How can I list through them in the report itself?
Joshua
+1  A: 

When using JRBeancollectionDataSource i prefer to do the following:

  1. Make sure to put the project class-path in "Report Import Directives" in iReport
  2. When creating the report query or the subdataset query. Open the Report Query dialog, choose the next tab "JavaBean data source" and write down the full path name of the bean. Then click "Read attributes", it should read all fields with getters.
  3. Choose the fields you want and click Add Selected Fields.

You will find all those you chose as $F(fieldName) in the report.

medopal