Jump to content

An Empty data source running from app.


tanvirtonu

Recommended Posts

I have a report which I want to populate with data given from my application not database.I have created and compiled the report with empty data source in Ireport.

But, now I cant run that report from my application.Previously,I could run any .jasper file (with active connection)from the following code

 

Code:
JasperPrint jasperPrint = JasperFillManager.fillReport(reportFileName, map, jdbcConnection);
JasperViewer.viewReport(jasperPrint,false);

 

Now,what code should I write to run compiled jasper file which has empty data source.

One more thing,if I pass a Map object from my application into report,how can I get the key and value of that map in Ireport/expression editor.Please help me.

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Put "new JREmptyDatasource()" instead of your connection object, and in your report design you have to define all the parameters that you want to use. Then, in your code, you can put something like

parameterMap.put("MY_PARAM", paramValue);

and use the $P{MY_PARAM} to get the value from the map.

Link to comment
Share on other sites

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