I have an invoice report, which contains - in the detail band - an invoice-item subreport used to display the invoice item records for the invoice. Passed to the invoice-item subreport is an integer invoice id, which is the foreign key for the items (typical 1-N scenario). The invoice report and the invoice-item subreport share a report connection (FYI).
Within the invoice-item subreport is another subreport - the sales-office subreport. The connection type property of the sales office subreport specifies "Use a datasource expression," and the datasource expression itself specifies a parameter from the invoice-item subreport: "$P{SUBREPORT_DATA_SOURCE}."
$P{SUBREPORT_DATA_SOURCE} is defined as follows:
new JRCsvDataSource(new File("/opt/reports/sales_offices.csv"))
The sales_offices.csv file referenced above contains two columns COLUMN_0 and … 1. COLUMN_0 contains the country name in which the sales office is located, and COLUMN_1 contains the sales-office address. COLUMN_0 is used in the filter expression, while COLUMN_1 is used for display. e.g.
Filter expression in sales-office subreport is: new Boolean($P{COUNTRY_NAME}.equals($F{COLUMN_0})) where $P{COUNTRY_NAME} is a parameter (the only parameter) passed to the sales-office report from the invoice-items report.
Everything works well. Meaning that the invoice report displays N number of invoice items via the invoice-items subreport, and the sales-office report displays the correct sales office via the sales-office subreport, per the country name passed from invoice items in $P{COUNTRY_NAME}. The trouble is though that the sales office ***only ever displays for the first invoice item***. It does not display for each invoice item as it should.
I'm pretty baffled by this and don't really know where to look for a solution.
Any help would be much appreciated.