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

Passing Parameter to a JavaBean datasource


2006 IR Open Dicussion

Recommended Posts

By: Craig Butts - craigbutts

Passing Parameter to a JavaBean datasource

2006-05-02 13:59

I have developed a report based on a JavaBean and now I need to be able to pass a parameter to the JavaBean. Is there a way in iReport to do this?

 

 

 

 

By: N Olding - oldingn

RE: Passing Parameter to a JavaBean datasourc

2006-05-02 14:13

Use a HashMap, and pass it as a parameter to the Fill call.

Here's an example that passes today's date as a parameter, plus a bean with some other data:

 

Map inputParameters = new HashMap();

inputParameters.put("today", new Date());

 

APJasperRptBean bean = new APJasperRptBean();

bean.setAddr1(addr1);

bean.setAddr2(addr2);

bean.setAddr3(addr3);

APJasperRptBean[] beans = new APJasperRptBean[1];

beans[0] = bean;

JRDataSource jds = new JRBeanArrayDataSource(beans);

 

jasperPrint = JasperFillManager.fillReport(jr,

inputParameters, jds);

 

Hope it helps.

N.

 

 

 

 

By: Craig Butts - craigbutts

RE: Passing Parameter to a JavaBean datasourc

2006-05-02 15:03

N,

Thank you for your response, this answers a question I had about how to fill the parameter when I go to deploy the report. However, I should have been clearer in my request. Is there a way - while in the iReport tool - to pass a parameter to the javabean? I found an article [12341537] that indicates states the JavaBean factory method cannot contain parameters. This article was from 2004. Is this still a limitation as this is what I am really trying to do.

 

Thanks again for your response - the information does help me for a later point in my development.

 

Sincerely,

Craig...

Link to comment
Share on other sites

  • 5 years later...
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 weeks later...

I have the same problem..

The SQL is not powerfull enough to match my need and if the JavaBean datasource has no way to receive parameters then i don't know what it can be used for...

So, if someone find a way to pass params to a JavaBean datasource, i'm really really interested, or i will have to fine another reporting tool :(

Link to comment
Share on other sites

  • 1 year later...

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