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

How do you find your subreport's location?


manshack_one

Recommended Posts

Consider this scenario:

main
>>subreport1A
>>subreport2A
>>>>subreport2B
>>subreport3A

To describe this, the main report has 3 subreports.  Subreport 2A has a nested subreport (2B).  When I publish main from iReport using the repository navigator it includes subreports1A, 2A and 3A but does not include the nested subreport 2B.  During the publishing process iReport also edits the main.jrxml altering the first level subreports to include "repo:" in the name.  However it does not upload 2B.  This leads to an "object could not be loaded from location" error when I run main in JS.

In my case each of the subreports are already loaded individually as main reports themselves.  The main in this situation I'm describing is a wrapper report that simply includes the others as subreports.  Kind of an easy way of merging reports together so you only run 1 versus 7 individual ones. 

Which brings me to my question.  How do I find the location of the existing nested subreport 2B?  Since it was included whenever 2A was published separately I should just be able to reference it from this copy of subreport2A that main is including right?

I've never had to add subreports as a resource in JS because this ability to publish them from iReport using the repository navigator was much simpler for me.  I like working this way so that I can use the report in iReport and on JS without having to worry about changing the jrxml every time it's uploaded.  While I'm thinking about it, where does JS store the reports you publish? 

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

The problem with sub-subreports and publishing is a bug - please log it.

 

The report JRXMLs are stored in the repository. When needed (after an update), the JRXML is compiled and the .jasper byte code is also stored in the repository.

 

Sherman

Jaspersoft

Link to comment
Share on other sites

Tracker items 4419 and 4421 have been created for problems publishing from iReport using the repository navigator.  The first problem I've already described about "nested subreport awareness".  The other tracker is for a problem with not being asked to change the relative path if you're just updating a report that included a subreport.

That being said here's what I ended up doing:

1) from iReport using repository navigator upload master report that includes nested subreports (see first post for example)
2) from JS edit master report and add in nested subreports as a resource on the resources and input control section.
3) from iReport, navigate to report you just uploaded and expand the resources section.
4) double click to open temp copy of first level subreport (2A in the example).
5) from iReport designer click the XML button to view the jrxml file in the designer window
6) scroll to bottom of file and look for subreport expression
7) alter subreport expression by dropping the subreport directory parameter and changing the part inside the quotes to read something similar to this depending on your installation "repo:/reports/main_files/2B.jrxml"
8) click the save icon then the designer icon.
9) navigate back to the subreport "2A" in the repository navigator and right click it choosing "update file from current jrxml".
10) repeat steps 4-9 for each additional first level subreport that contains a nested subreport.

I ended up finding the "main_files" part inside the actual mysql jasperserver tables from just poking around.  Nice trick using a hidden flag to have them not show up in the JS report screen.  :)  Since I was adding the subreports as resources to the master report I had to use it's "main_files" directory instead of just "/reports/" since the subreport wasn't added separately in JS.  It never dawned on me that you might be storing the files in the actual database.  I'd been trying to create a literal path based off the directories on the server hard drive.

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