Jump to content
Changes to the Jaspersoft community edition download ×

How to create a subreport based on CSV file


salhaber
Go to solution Solved by reportdev,

Recommended Posts

I have two reports in jaspersoft studio based on two different CSV files with different columns and both runs normally.

I want to include one of them as a subreport of the other, when I drag and drop the subreport element into the detail section and choose the report as my source it creates a dataset and ask me for the dataset data source, what should be the data source in my case? I cannot set it to $P{REPORT_DATA_SOURCE} because it will take the data source of the main Report and not the Subreport which has different CSV/columns.

The subreport can be linked to the main report by a common column which is a key column in the CSV.

My only problem is what should be the data source of the Subreport? 

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Solution

When you drag the subreport, the subreport element asks for the Report Connection. Report Connection is not a dataset. its just an initiator for your subreport. Usually $P{REPORT_CONNECTION} is the report connection that works.

In order to achieve your requirement.

  • Create a subreport first by using your csv datasource in the studio

  • Place your csv datasource on the server repository and copy the path to it

  • The path should be pasted in the default data adapter section of your subreport. this way whenever the subreport get initiated it does not look for the main report jdbc connection

  • Publish the subreport and test if the subreport works fine with the default csv data adapter

  • Put your subreport in the main report and pass the parameters to it.
Link to comment
Share on other sites

  • 1 year later...

I have the same problem. I followed the instructions below, my subreport works fine with the csv as the default datasource, but when I embed it into the main report, it simply does nothing. The subreport prints no data at all. The last tip below says:

Put your subreport in the main report and pass the parameters to it.

I ask, what parameters?

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