Bnrdo Bnrdo - 5 months ago 31x
Java Question

Detail band of subreport not showing

My main report contains 5 fields, 4 of them are of type java.lang.String and the last one is of type java.util.List. I used its latter as the data source for the subreport. I set the datasource of the subreport.

Subreport properties:

Connection Type : Use a datasource expression

Datasource Expression : new$F{Field5})

Passing of data is working fine (I guess) because when I fill the report inside the Java application. I can view the data passed to fields 1 to 4 but in field 5, at first, I can't verify because the subreport does not show data, only the static texts defined in the Column Header.

Then when I placed the fields of the subreport in the Page Footer, I found out that the data is passed successfully, the problem is that the Detail band itself is not showing.

Why is it not showing?

In the subreport properties, I have:

When no data: All Sections, No Detail

Please can anyone shed some light on this.


I had the same problem for more than 1 day. In the application I am developing on there are multiple JasperReports which work. I encountered this problem when adding a new one. No matter what I tried, nothing displayed in the Detail band. I tried everything from triple-checking the Controller that populates the report, to upgrading to the latest jasperreports jar and latest iReports version. Nothing seemed to work.

The problem is that the report is set by default to: When No Data: All Sections, No Detail, which basically means that if no data is sent to the report, it will display all sections, except for the Detail one.

Although besides static text which I was using to test the report I was passing parameters directly from the Java Controller, it did not work until I added an EXEC [myFunction] $P{parameterId} to the Query Text property of the report. The function is a simple straightforward one, which takes a parameterId passed from Java as a parameter and returns something. (also, make sure you set the The language for the dataset query sql property to SQL).

To sum up, for some reason the report doesn't seem to take the Java parameters as data (so it displays all the sections, except for Detail), so when I explicitly call a SQL function which returns some parameters and put them into my detail page, it works.

I hope this helps you, I busted my head for 10 hours to figure this out.