Jump to content
Changes to the Jaspersoft community edition download ×

Selecting Subreports at runtime


vij

Recommended Posts

Hello

 

I have a requirement where i need to create a PDF document with Several sections in it. Each section is either a Free Form Data or Tabular Data. The user has the ability to select or deselct sections from front-end to print what sections they want.

 

I'm trying this with a one main report and creating subreport for each section. When someone do not want a particular section then i'm not passing my data to the JRDataSource. So i get a bank space in my main report.

 

I had like to reallign all the Subreports based on the user selected ones. How do i do this with Subreports.

 

What is the best solution here with this kind of requirement.

 

Appreciate your help on this

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Hi,

 

What exactly do you mean by realigning?

 

Note that the subreport names themselfs could be passed

as parameters, or even report fields.

You could have a single subreport element in your master report detail section, and the subreport names could come as the value of a field in the master report data source.

So if the user selects 5 subreport, you could devise a way and fill the master report with a custom data source that has 5 records, one for each of the subreports that were selected.

 

I hope this helps.

Teodor

Link to comment
Share on other sites

Thank you for the reply.

 

The way i did is that i have 4 sections( each section is a subreport) in the report. I have positioned two subreports each side by side in the master detail band.

 

During run time if user selects Subreport1 and Subreport4..I had like them print side by side. Currently in my report i get a blank space for section2 and 3 since i dont pass data to those subreports.

 

I like your solution, but i'm not sure how i do that. I can define one field in the master report detail section. During runtime, i can pass the selected subreport name as the Custom Datasource data. But i'm not sure how i convert that field as Subreport. I can pass the subreport datasource using master report parameter. but where do i define the Subreport Datasource expression since it is not available until runtime.

 

 

Thanks

VJ

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