[#11846] - Two subreports with same data source expression; 2nd subreport not shown

Bug report
Project: Severity:
Component: Reproducibility:
Assigned to:

Scenario: A Main report and two separate sub reports.

The 1st subreport is only used to calculate some values from a sub query which I then need in the main report. This subreport is one px high and is placed within the title band of the main report. No other element is within the title band.

The second one is placed within the page header where all other visible elements are also placed. This subreport should actually print something but not return any values to the main report.

Both subreports have the same data source configured. The reason why I am using 2 separate subreports is because I need the results of the 1st subreport to control the "print when expression" of some other fields on the main report and I need them before the 2nd subreport is being printed.

This is with iReports 5.6.0 and I was not able to get the evaluation of the returned value, set within a variable in the main report at run time within the same band. The only reliable way for me was to create a separate subreport and to put it in a band which is evaluated before the one where I need the data.


The problem now is that in the moment when I let the 1st subreport evaluate in the Title band (the return values are set correct within the Main Report, nothing is printed in the title band as there is nothing to print) - but then the 2nd subreport does not show up anymore in the resulting rendering.

There is no print when expression on the 2nd subreport - neither within any of the fields in it.


This is easily and - for me always - reproducable

(1) Create Subreport 1 with a data source expression and put it e.g. in the page header.
(2) Test-Render the MainReport --> Result: Subreport 1 is shown
(3) Copy Subreport 1 on the MainReport and place the copy of it (Subreport 2) in the title band (without changing data source expression)
(4) Copy also the jasper file of the 1st subreport and give it another name.
(5) Modify Subreport expression to point to the 2nd subreport jasper file
(6) Test-Render the MainReport --> Result: Subreport 2 in the Title is shown - but Subreport 1 in Page header band has disappeared

Goal: Render also the 2nd subreport and have data source expression of Subreport 1 and 2 the same.

Hint: If the data source expressio of the two subreports are different, both of the 2 subreports are shown.

iReport Designer
michael.hafner's picture
Joined: Sep 20 2018 - 10:36am
Last seen: 3 weeks 5 days ago