Jump to content
JasperReports Library 7.0 is now available ×

Subreport, custom datasource and parameters


Recommended Posts

By: psvsf - psvsf

Subreport, custom datasource and parameters

2006-05-03 21:07

I all,

Will really appreciate if can help me in following issue:

 

I have around 1000+ reports (with subreports) to migrate from some commerical reporting system.

 

Each report(master and subreports) have its own cutom data source (which internally call its jdbc methods passing those parameter's values).

 

Problem I am struggling is how subreport custom datasource will know from where to get field values to call its methods? As I understand Custom JRDataSource only need to implement two methods next() & getFieldValue(). Neither of these two method is passing the field value(s) from master report to sub report so sub datasource can pickup exact data based on that field value(s) passed.

 

Note:

1. My nested reports WITHOUT custom data sources works fine

2. I am passing JasperReport and custom datasource of SUBREPORTS as parameter in HashMap in method call JasperFillManager.fillReport(jasperReport, map, ds);

 

The master jrxml file has following elements:

<subreportParameter name="sb_field_1_id">

<subreportParameterExpression><![CDATA[$F{ms_field_1_id}]]></subreportParameterExpression>

</subreportParameter>

<dataSourceExpression><![CDATA[$P{SUB_REPORT_DS_1}]]></dataSourceExpression>

<subreportExpression class="net.sf.jasperreports.engine.JasperReport"><![CDATA[$P{SUB_REPORT_JR_1}]]></subreportExpression>

 

 

Thanks in advance for any hint or link with working examples

 

 

 

 

 

 

By: psvsf - psvsf

RE: Subreport, custom datasource and paramete

2006-05-04 14:15

Let me redefine the problem as it seems first post bit confusing as on one replied yet:

 

1. I have nested subreports.

2. Each report (including subreport) has its own custom datasource (using DataSourceExpression in its master report).

3. Each SubDatasource internally contains its DTO objects.

4. Subreports name and custom datasource is passed to JasperFillManager.fillReport using hashmap.

 

Now question is when next() method of subreport datasource is called, how datasoure will know dynamically what field value(s) to use to go to database to get in required set of DTO items.

 

 

 

 

 

By: jasperkan - jasperkannan

RE: Subreport, custom datasource and paramete

2006-05-10 07:51

i used custom Datasource in a collection where i specified the MAP KEY as the same name of the FIELD NAME . So i had a Map of Maps and the inner map corresponds to a row with the keys corresponding to the fields names and the value the corresponding values for that row .

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