Subreports in JasperReport Templates

I made a sub-report in the report template. But when I run the report, only the sub-report is printed, but the main one is not. Is there a way to normally output a main report with a sub-report?

Hello,

Can you give an example of your report?

Regards,
Nikita

template.zip (39.8 KB)

So what’s up with the sub reports? Can they be created at all in Jmix or not?

I looked at your report. In the report, you have two report templates. When you run the report, the default template will be selected.

To generate a history report and sub report, you need to run the report twice with different report templates or create one report template that will contain information from two templates.

“create one report template that will contain information from two templates” - so, a template in which there will be two subreport elements, right?

This is a report template in jrxml format in which on one page there will be information from rep_history_amount.jrxml, and on the other page there will be a table from sub_report.jrxml. As a result, you receive one report with all the information.

Regards,
Nikita

It doesn’t work. I made two bands on the third template. But as a result, it outputs only the first sub-report template.
image

It’s difficult to understand from your screenshot what the problem is. Please send a demo project or sample reports.

Regards,
Nikita

template.zip (48.7 КБ)

Your solution won’t work. You need to place the xml layout of the report from two templates into one template (main.jrxml).

Regards,
Nikita

1 Like

Can you please post an example, otherwise I don’t quite understand how to do it correctly.

Hi Vika

Attached you find a sample.jrxml

There are 2 bands, one is the head and one is the data band with all the positions of this invoice.

Hopefully it helps.

Felix
Sample.zip (5.0 KB)

Thanks, I’ll take a look now =)

Well, this is a regular report with a table. And I needed it for a sub-report. But thanks anyway for trying to help solve my problem =)

Well, attached you find a sample with several SubReports which are included based on the data which are printed.

I think the easy case which you show here, might be easier solved with a table.

Reports.zip (38.3 KB)

did you have any solution for this