Jasper Subreport Only Populating On First Page - Java

0

I have a main report with a subreport in the group footer. The goal is to show this subreport on every page. In Jaspersoft Studio this works perfectly but when I compile and fill the template in my Spring service, the subreport is only filled on the first page. When I put "All Sections No Detail" for "When No Data Type", I only see the column headers. I have spent hours upon hours trying to debug with no success. Below is the jrxml and java code.

<pre class="lang-java s-code-block hljs" style="margin-top: 0px; margin-right: 0px; margin-bottom: calc(var(--s-prose-spacing) + 0.4em); margin-left: 0px; padding: 12px; border: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-weight: 400; font-stretch: inherit; line-height: 1.30769; font-family: Consolas, Menlo, Monaco, &quot;Lucida Console&quot;, &quot;Liberation Mono&quot;, &quot;DejaVu Sans Mono&quot;, &quot;Bitstream Vera Sans Mono&quot;, &quot;Courier New&quot;, monospace, sans-serif; font-size: 13px; vertical-align: baseline; box-sizing: inherit; width: auto; max-height: 600px; overflow: auto; background-color: var(--highlight-bg); border-radius: 5px; color: var(--highlight-color); overflow-wrap: normal; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-size: 13px; vertical-align: baseline; box-sizing: inherit; background-color: transparent; white-space: inherit;">&lt;groupFooter&gt;
    &lt;band height=<span class="hljs-string" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-size: 13px; vertical-align: baseline; box-sizing: inherit; color: var(--highlight-variable);">"144"</span>&gt;
        &lt;subreport&gt;
            &lt;reportElement x=<span class="hljs-string" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-size: 13px; vertical-align: baseline; box-sizing: inherit; color: var(--highlight-variable);">"70"</span> y=<span class="hljs-string" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-size: 13px; vertical-align: baseline; box-sizing: inherit; color: var(--highlight-variable);">"90"</span> width=<span class="hljs-string" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-size: 13px; vertical-align: baseline; box-sizing: inherit; color: var(--highlight-variable);">"642"</span> height=<span class="hljs-string" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-size: 13px; vertical-align: baseline; box-sizing: inherit; color: var(--highlight-variable);">"30"</span> uuid=<span class="hljs-string" style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: inherit; font-size: 13px; vertical-align: baseline; box-sizing: inherit; color: var(--highlight-variable);">"47af6568-4e1c-4dc4-8688-dfb4d6e17bbc"</span>/&gt;
            &lt;dataSourceExpression&gt;&lt;![CDATA[$P{TEMPLATE_DATA}]]&gt;&lt;/dataSourceExpression&gt;
            &lt;subreportExpression&gt;&lt;![CDATA[$P{TEMPLATE_XML}]]&gt;&lt;/subreportExpression&gt;
        &lt;/subreport&gt;
    &lt;/band&gt;
&lt;/groupFooter&gt;</code></pre>
Map<String, Object> parameters = new HashMap<>()
parameters.add("TEMPLATE_XML", compiledSubReport)
 
List<entity> entityList = util.getEntities()
JRBeanCollectionDataSource data = new JRBeanCollectionDataSource(entityList)
 
parameters.add("TEMPLATE_DATA", data)
 
return JasperFillManager.fillReport(mainReport, parameters, mainDataSource)

AJGERBER0205's picture
Joined: Dec 19 2019 - 1:43pm
Last seen: 3 days 21 hours ago

0 Answers:

No answers yet
Feedback