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

Problem with subreport


nedemon

Recommended Posts

 Hey guys, i've got a pretty problem on my hand.

First of all, i've got a huge project where i can't that easily upgrade a library, so im using jasperreports 3.7.0

I've tried upping it but better not, cause i'm starting to get all this crap about wrong xml headings and standarts and so on, so im working with what i have.

Therefore, i've got no tables.

 

Basically, the structure of my programs is so that i create a JRBeanArrayDataSource, pass it in as a JRDataSource in JasperFillManager.fillReport(...) and everything goes on from there.

I've got 6 fields in my .jrxml file so without a subreport everything went fine - i've gotten a relatively dynamic table, its height depending on the count of rows given to JRBeanArrayDataSource.

 

Once i've gotten a subreport, the fields just don't display. Basically, i wanna use REPORT_DATA_SOURCE from main report in the subreport. And I'm not using it in the main report at all, just wanna pass it. I've set it as a datasource for my subreport, i've even passed it as a parameter but it just doesn't seem to work for me, my subreport goes to NoData section no matter what. And i have data there, i know that.

I've declared fields with the same names there, the datasource being passed there isn't null, i checked it with Display when condition. But it just doesn't retrieve fields!  

Btw, i could even retrieve number of records and it's greater than 0 each time.

And when i drop the subreport, it does display them perfectly.

Is there any sort of mapping i gotta do besides passing REPORT_DATA_SOURCE as a parameter and setting it as a datasource for subreport? What type should i use while passing - JRDataSource or JRBeanArrayDataSource?

 

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

I am using JRBeanCollectionDataSource. In some case I declare parameter of main report as java.util.Collection and pass my collection into this parameter, for example "srcDataSource".

 

In subreport expression "new MyClassDataSource($P{srcDataSource})" and

MyClassDataSource must implements JRDataSource interface.

 

May be you try expression new JRBeanArrayDataSource($P{srcDataSource}) ?

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