Sub-report name linkage
I got very confused earlier today. I have a report with sub-reports, and I was modifying the sub-report and re-uploading it. However, the output from running the report was not changing.
It turned out that I had another test report using the same content file name (which was in fact an old version of the subreport I was modifying).
Hence I had:
- report zz-test with content xyz.jrxml
- report abc that invokes a sub-report with subreport expression "xyz.jrxml"
- subreport xyz with content xyz.jrxml
Running report abc used the content from the zz-test report.
The fix was to delete the document template zz-test - which got rid of the old copy of xyz.jrxml, and the when I ran report abc, this picked up the correct content.
Given that all the subreport expresssion contains is the content file name, having two content blocks in the system with the same file names is obviously going to lead to problems.
I don't think that having two reports that use content having the same name causes the same type of problem because the content is coupled to the report. The problem only occurs with subreports.
Is it possible to tweak the code so that when grabbing the sub-report content, it checks whether there is more than one with the same name - and it so, generates a failure.
Regards, Tim
PS I also discovered that if you set the report type of the subreport to 'report' (rather that 'subreport') it can still be used as a subreport by the parent report, but will now show up in the Reporting|Reports list and so can be run by itself.
Re: Sub-report name linkage
Can you raise a JIRA?
I think a better solution in the longer term would be to handle sub-reports as relationships in the document template, rather than as separate document templates. It would prevent sharing sub-reports, but I don't think that is much of an issue.