subreport took the source of the main report

Hello, is it possible to make the sub-report take the data source from the main report, if so, how?
I load a report on jasperserver and it turns out that it should work on 14 databases and I would like to have a data source only for the main report than to do 28 actions of the same type

I also sent the subreport file to the jasperserver, but it does not see it, although it is on the server. when adding a subreport, the folder shows that it is empty

deadsploid's picture
Joined: Nov 9 2022 - 1:06am
Last seen: 1 week 6 days ago

Thank you for posting to the Jaspersoft Community. Our team of experts has read your question and we are working to get you an answer as quickly as we can. If you have a Jaspersoft Professional Subscription plan, please visit for direct access to our technical support teams offering guaranteed response times.

mrajkuma - 3 months 3 weeks ago

3 Answers:

If you use the standard approach of 


in your subreport reference configuration, that $P{REPORT_CONNECTION} is the datasource of the parent report. So what you're asking about is the default behavior. By default, if you pass that $P{REPORT_CONNECTION} as the connection expression, it will use whatever the parent report is using. In terms of supporting 14 databases dynamically, there are definitely ways this can be done, but they're fairly advanced configurations.


If you're not seeing the subreport being populated on JasperServer, JasperStudio may not be able to find it when you initially publish the parent report. If you're publsihing these via studio, during the 'create server report' wizard, you'll see any/all of the resources being promoted as part of the report unit. If these aren't getting published at that point, it's typically due to the subreport 'path to file'. You can always add subreports directly on jasper server via the 'edit report' options, but you may also need to update the 'path to file' to reflect 'repo:subreportName.jrxml' and so on. 

darth_fader's picture
Joined: Mar 7 2010 - 9:45pm
Last seen: 8 hours 12 min ago

Thank you very much for your answer.
I'm sorry I didn't phrase it that way. The problem is that when I want to use a subport that is located on the jasperserver, then during the selection it does not see it in the directory. It appears and disappears for less than a second.
I will attach a screenshot of how everything looks in studio and server.

As you can see in the screenshot, there is a file on the server, but the studio does not see it. I tried to manually enter the path "repo:/recTemp/SubreportHeader.jrxml", but it says that the source was not found.
net.sf.jasperreports.engine.JRException: Resource not found at: repo:/recTemp/SubreportHeader.jrxml.

Image icon jasperanserw.png42.81 KB
deadsploid's picture
Joined: Nov 9 2022 - 1:06am
Last seen: 1 week 6 days ago
pjimenez_2's picture
Joined: Oct 26 2016 - 11:39am
Last seen: 2 weeks 5 days ago