Bar chart not showing all categories Jaspersoft Studio - jasper-reports

I am fairly new to creating charts in jasper but i'm at my wits end with this issue.
I have a data set that is returning proper data that is set up like so
+---------------------------------------------+
| qtr url_txt user_role_txt page_cnt |
+---------------------------------------------+
| Quarter 1 some url1 some role1 154 |
| Quarter 1 some url2 some role2 11 |
| Quarter 2 some url1 some role2 12 |
| Quarter 3 some url2 some role1 110 |
+---------------------------------------------+
But every iteration I have tried has failed so I tried another way to get this table (also returning correct data)
+-----------------------------------------+
| qtr url_txt role1_page role2_page |
+-----------------------------------------+
| Quarter 1 some url 1154 11 |
| Quarter 1 some url2 0 12 |
| Quarter 2 some url1 12 11 |
| Quarter 3 some url2s 11 0 |
+-----------------------------------------+
something similar and this got closer with getting the correct numbers but not the right quarters showing on the chart.
Only reason I am showing both versions of the data is because possibly the old version was better for this issue.
Here is how it was
Here is how it is now
In both instances, only 2 quarters tend to show up no matter the date range I choose (bottom one is one month off from the first picture)
it is usually showing a single quarter but every now and then I get quarter 1 and quarter 4 but there is obviously data in quarter 2 and 3 from when I run the query in the sql.
Here is the jrxml of the latest version
Any help would be amazing
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.3.1.final using JasperReports Library version 6.3.1 -->
<!-- 2018-08-21T14:23:03 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"
name="usg_rpt_bar"
pageWidth="576" pageHeight="792"
whenNoDataType="AllSectionsNoDetail"
columnWidth="536" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20"
isSummaryWithPageHeaderAndFooter="true"
uuid="c90df0e9-ca70-4aa8-88ab-3cc66cad2ade">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="New Data Adapter (2)"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.unit." value="inch"/>
<property name="net.sf.jasperreports.print.create.bookmarks" value="false"/>
<subDataset name="Dataset1" uuid="7d5280b5-f2f1-4d32-9729-2bb222a23169">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<queryString>
<![CDATA[]]>
</queryString>
</subDataset>
<parameter name="START_DATE" class="java.util.Date"/>
<parameter name="END_DATE" class="java.util.Date"/>
<parameter name="START_DATE_RPT" class="java.lang.String"/>
<parameter name="END_DATE_RPT" class="java.lang.String"/>
<parameter name="SCREENS" class="java.util.Collection"/>
<parameter name="Q1START" class="java.util.Date"/>
<parameter name="Q1END" class="java.util.Date"/>
<parameter name="Q2START" class="java.util.Date"/>
<parameter name="Q2END" class="java.util.Date"/>
<parameter name="Q3START" class="java.util.Date"/>
<parameter name="Q3END" class="java.util.Date"/>
<parameter name="Q4START" class="java.util.Date"/>
<parameter name="Q4END" class="java.util.Date"/>
<queryString>
<![CDATA[SELECT DISTINCT ON (url_txt)
t.qtr as qtr,
t.url_txt as url_txt,
sum(t.pub) as pub_page,
sum(t.itm) as itm_page,
sum(t.cms) as cms_page,
sum(t.gst) as gst_page,
sum(t.lib) as lib_page
from
(
SELECT
'Quarter 1' as qtr,
url_txt,
CASE when user_role_txt = 'Item Developers' then 1 else 0 end as itm,
CASE when user_role_txt = 'Public' then 1 else 0 end as pub,
CASE when user_role_txt = 'Librarian' then 1 else 0 end as lib,
CASE when user_role_txt = 'GST' then 1 else 0 end as gst,
CASE when user_role_txt = 'CMS' then 1 else 0 end as cms
from db.table
where acs_ts::date >= $P{Q1START}
AND acs_ts::date <= $P{Q1END}
AND $X{IN,url_txt,SCREENS}
UNION ALL
SELECT
'Quarter 2' as qtr,
url_txt,
CASE when user_role_txt = 'Item Developers' then 1 else 0 end as itm,
CASE when user_role_txt = 'Public' then 1 else 0 end as pub,
CASE when user_role_txt = 'Librarian' then 1 else 0 end as lib,
CASE when user_role_txt = 'GST' then 1 else 0 end as gst,
CASE when user_role_txt = 'CMS' then 1 else 0 end as cms
from db.table
where acs_ts::date >= $P{Q2START}
AND acs_ts::date <= $P{Q2END}
AND $X{IN,url_txt,SCREENS}
UNION ALL
SELECT
'Quarter 3' as qtr,
url_txt,
CASE when user_role_txt = 'Item Developers' then 1 else 0 end as itm,
CASE when user_role_txt = 'Public' then 1 else 0 end as pub,
CASE when user_role_txt = 'Librarian' then 1 else 0 end as lib,
CASE when user_role_txt = 'GST' then 1 else 0 end as gst,
CASE when user_role_txt = 'CMS' then 1 else 0 end as cms
from db.table
where acs_ts::date >= $P{Q3START}
AND acs_ts::date <= $P{Q3END}
AND $X{IN,url_txt,SCREENS}
UNION ALL
SELECT
'Quarter 4' as qtr,
url_txt,
CASE when user_role_txt = 'Item Developers' then 1 else 0 end as itm,
CASE when user_role_txt = 'Public' then 1 else 0 end as pub,
CASE when user_role_txt = 'Librarian' then 1 else 0 end as lib,
CASE when user_role_txt = 'GST' then 1 else 0 end as gst,
CASE when user_role_txt = 'CMS' then 1 else 0 end as cms
from db.table
where acs_ts::date >= $P{Q4START}
AND acs_ts::date <= $P{Q4END}
AND $X{IN,url_txt,SCREENS}
) as t
group by t.qtr, t.url_txt]]>
</queryString>
<field name="url_txt" class="java.lang.String"/>
<field name="qtr" class="java.lang.String"/>
<field name="itm_page" class="java.lang.Integer"/>
<field name="cms_page" class="java.lang.Integer"/>
<field name="gst_page" class="java.lang.Integer"/>
<field name="pub_page" class="java.lang.Integer"/>
<field name="lib_page" class="java.lang.Integer"/>
<sortField name="qtr"/>
<group name="Group1" keepTogether="true">
<groupExpression>
<![CDATA[$F{url_txt}]]>
</groupExpression>
</group>
<pageHeader>
<band height="98" splitType="Stretch">
<staticText>
<reportElement key="t_4" mode="Opaque"
x="130" y="-1" width="320" height="15"
isRemoveLineWhenBlank="true"
forecolor="#000000" backcolor="#FFFFFF"
uuid="70d07b08-a98f-462f-912c-86e8ca3cffa5">
<property name="net.sf.jasperreports.export.pdf.tag.h1"
value="full"/>
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
</reportElement>
<box>
<topPen lineWidth="0.0" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Top">
<font fontName="Arial" size="12" isBold="true"/>
<paragraph lineSpacing="Single"/>
</textElement>
<text><![CDATA[DEL Report]]></text>
</staticText>
<textField pattern="([GENERAL])" isBlankWhenNull="true">
<reportElement key="COMPUTE_5" mode="Opaque"
x="140" y="15" width="300" height="15"
forecolor="#000000" backcolor="#FFFFFF"
uuid="fa243ebd-82b3-426a-8693-995a1d029d8c">
<property name="net.sf.jasperreports.export.pdf.tag.h2"/>
<property name="net.sf.jasperreports.export.pdf.tag.h1"
value="full"/>
</reportElement>
<box>
<topPen lineWidth="0.0" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Top">
<font fontName="Arial" size="12" isBold="true"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression>
<![CDATA["Data Element Library Usage Report"]]>
</textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="true">
<reportElement key="DATE_1" mode="Opaque"
x="430" y="0" width="102" height="12"
forecolor="#000000" backcolor="#FFFFFF"
uuid="8c30e5fd-4921-4b61-a07d-fec225f73dca">
<property name="net.sf.jasperreports.export.pdf.tag.h2"
value="full"/>
<property name="net.sf.jasperreports.export.pdf.tag.h3"/>
</reportElement>
<box>
<topPen lineWidth="0.0" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineColor="#000000"/>
</box>
<textElement verticalAlignment="Top">
<font fontName="Arial" size="8"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression>
<![CDATA["Run Date: " + new SimpleDateFormat("MM/dd/yyyy").format(new Date())]]>
</textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="true">
<reportElement key="PAGE_1" mode="Opaque"
x="430" y="12" width="40" height="12"
forecolor="#000000" backcolor="#FFFFFF"
uuid="d3278171-f2e1-4241-b57f-5e4f3fc2ee09">
<property name="net.sf.jasperreports.export.pdf.tag.h2"
value="start"/>
<property name="net.sf.jasperreports.export.pdf.tag.h3"/>
</reportElement>
<box>
<topPen lineWidth="0.0" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineColor="#000000"/>
</box>
<textElement verticalAlignment="Top">
<font fontName="Arial" size="8"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression>
<![CDATA["Page " + $V{PAGE_NUMBER} + " of "]]>
</textFieldExpression>
</textField>
<textField evaluationTime="Report" pattern="" isBlankWhenNull="true">
<reportElement key="PAGE_1" mode="Transparent"
x="470" y="12" width="30" height="12"
forecolor="#000000" backcolor="#FFFFFF"
uuid="f12aa9ee-4dbb-4569-bad4-1994dcfc045c">
<property name="net.sf.jasperreports.export.pdf.tag.h3"/>
<property name="net.sf.jasperreports.export.pdf.tag.h2"
value="end"/>
</reportElement>
<box>
<topPen lineWidth="0.0" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineColor="#000000"/>
</box>
<textElement verticalAlignment="Top">
<font fontName="Arial" size="8"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression>
<![CDATA[$V{PAGE_NUMBER}]]>
</textFieldExpression>
</textField>
<image>
<reportElement x="0" y="0" width="150" height="56"
uuid="5c21389e-0147-4bab-8b2b-b2462883c4e4">
<property name="com.jaspersoft.studio.unit.width"
value="pixel"/>
<property name="com.jaspersoft.studio.unit.height"
value="pixel"/>
</reportElement>
<imageExpression>
<![CDATA[$P{CMSLOGO_DIR} + "CMS_logo.jpg"]]>
</imageExpression>
<hyperlinkTooltipExpression>
<![CDATA["Centers for Medicare & Medicaid Services"]]>
</hyperlinkTooltipExpression>
</image>
<staticText>
<reportElement x="0" y="70" width="280" height="12"
uuid="9f93ebb5-6ca9-4f7f-be7c-d06093207859">
<property name="net.sf.jasperreports.export.pdf.tag.h3"
value="start"/>
<property name="com.jaspersoft.studio.unit.height"
value="pixel"/>
</reportElement>
<textElement verticalAlignment="Top">
<font fontName="Arial" isBold="false"/>
</textElement>
<text><![CDATA[Note: * indicates an empty value.]]></text>
</staticText>
<textField>
<reportElement x="140" y="30" width="300" height="20"
uuid="c2b0287c-ce1e-461c-aabb-1c6e28b0b30d"/>
<textElement textAlignment="Center"/>
<textFieldExpression>
<![CDATA["From "+$P{START_DATE_RPT}+" to "+$P{END_DATE_RPT}]]>
</textFieldExpression>
</textField>
</band>
</pageHeader>
<detail>
<band height="285">
<barChart>
<chart isShowLegend="true">
<reportElement key="" x="0" y="40" width="532" height="245"
uuid="090b7b3c-b745-45bd-af08-3b79a027f3c6">
<property name="com.jaspersoft.studio.unit.y" value="inch"/>
</reportElement>
<chartTitle position="Top">
<titleExpression><![CDATA[$F{url_txt}]]></titleExpression>
</chartTitle>
<chartSubtitle/>
<chartLegend position="Right"/>
</chart>
<categoryDataset>
<dataset resetType="Page"/>
<categorySeries>
<seriesExpression><![CDATA["Public"]]></seriesExpression>
<categoryExpression><![CDATA[$F{qtr}]]></categoryExpression>
<valueExpression><![CDATA[$F{pub_page}]]></valueExpression>
</categorySeries>
<categorySeries>
<seriesExpression><![CDATA["CMS"]]></seriesExpression>
<categoryExpression><![CDATA[$F{qtr}]]></categoryExpression>
<valueExpression><![CDATA[$F{cms_page}]]></valueExpression>
</categorySeries>
<categorySeries>
<seriesExpression><![CDATA["GST"]]></seriesExpression>
<categoryExpression><![CDATA[$F{qtr}]]></categoryExpression>
<valueExpression><![CDATA[$F{gst_page}]]></valueExpression>
</categorySeries>
<categorySeries>
<seriesExpression><![CDATA["Librarian"]]></seriesExpression>
<categoryExpression><![CDATA[$F{qtr}]]></categoryExpression>
<valueExpression><![CDATA[$F{lib_page}]]></valueExpression>
</categorySeries>
<categorySeries>
<seriesExpression><![CDATA["Item Developers"]]></seriesExpression>
<categoryExpression><![CDATA[$F{qtr}]]></categoryExpression>
<valueExpression><![CDATA[$F{itm_page}]]></valueExpression>
</categorySeries>
</categoryDataset>
<barPlot>
<plot backgroundAlpha="1.0"/>
<itemLabel/>
<categoryAxisLabelExpression><![CDATA["Quarter"]]></categoryAxisLabelExpression>
<categoryAxisFormat>
<axisFormat labelColor="#000000" tickLabelColor="#000000" axisLineColor="#000000"/>
</categoryAxisFormat>
<valueAxisLabelExpression><![CDATA["Page Count"]]></valueAxisLabelExpression>
<valueAxisFormat>
<axisFormat labelColor="#000000" tickLabelColor="#000000" axisLineColor="#000000"/>
</valueAxisFormat>
</barPlot>
</barChart>
</band>
</detail>
</jasperReport>
Edit: I have been in the same position and found that changing the select distinct on changes how the graph interacts, I have yet to find a proper way to finish this still. This has been the only combination that even gets multiple quarters, all other attempts made a new chart for each quarter and each role.

Related

Jasper creating a bar chart for each series variable

I am creating a report that requires multiple barcharts to track what user is going to which page based on user role.
Each role is its own series, however when I run the report I am getting the correct data but each series is making its own bargraph
I.E I have two search pages A and B
A public user goes to A 5 times and B twice
an Admin goes to B 2 times and B 9 times
the report would create 4 reports: public/A, public/B, admin/A,admin/B
However the chart should be public and admin on the same chart for A and one more for B
Any ideas
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.3.1.final using JasperReports Library version 6.3.1 -->
<!-- 2018-08-17T13:07:36 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="DEL_sys_usg_rpt_bar" pageWidth="576" pageHeight="792" whenNoDataType="AllSectionsNoDetail" columnWidth="536" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isSummaryWithPageHeaderAndFooter="true" uuid="c90df0e9-ca70-4aa8-88ab-3cc66cad2ade">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="New Data Adapter (2)"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.unit." value="inch"/>
<property name="net.sf.jasperreports.print.create.bookmarks" value="false"/>
<parameter name="START_DATE" class="java.util.Date"/>
<parameter name="END_DATE" class="java.util.Date"/>
<parameter name="START_DATE_RPT" class="java.lang.String"/>
<parameter name="END_DATE_RPT" class="java.lang.String"/>
<parameter name="SCREENS" class="java.util.Collection"/>
<parameter name="Q1START" class="java.util.Date"/>
<parameter name="Q1END" class="java.util.Date"/>
<parameter name="Q2START" class="java.util.Date"/>
<parameter name="Q2END" class="java.util.Date"/>
<parameter name="Q3START" class="java.util.Date"/>
<parameter name="Q3END" class="java.util.Date"/>
<parameter name="Q4START" class="java.util.Date"/>
<parameter name="Q4END" class="java.util.Date"/>
<queryString>
<![CDATA[SELECT
t.qtr,
t.url_txt as url_txt,
sum(t.role0) as role0_page,
sum(t.role1) as role1_page,
sum(t.role2) as role2_page,
sum(t.role3) as role3_page,
sum(t.role4) as role4_page,
t.user_role_txt as user_role_txt
from
(
SELECT
$P{Q1START} as qtr,
url_txt,
user_role_txt,
CASE when user_role_txt = 'Role0' then 1 else 0 end as role0,
CASE when user_role_txt = 'Role1' then 1 else 0 end as role1,
CASE when user_role_txt = 'Role2' then 1 else 0 end as role2,
CASE when user_role_txt = 'Role3' then 1 else 0 end as role3,
CASE when user_role_txt = 'Role4' then 1 else 0 end as role4
from table
where acs_ts::date >= $P{Q1START}
AND acs_ts::date <= $P{Q1END}
AND $X{IN,url_txt,SCREENS}
UNION ALL
SELECT
$P{Q2START} as qtr,
url_txt,
user_role_txt,
CASE when user_role_txt = 'Role0' then 1 else 0 end as role0,
CASE when user_role_txt = 'Role1' then 1 else 0 end as role1,
CASE when user_role_txt = 'Role2' then 1 else 0 end as role2,
CASE when user_role_txt = 'Role3' then 1 else 0 end as role3,
CASE when user_role_txt = 'Role4' then 1 else 0 end as role4 from table
where acs_ts::date >= $P{Q2START}
AND acs_ts::date <= $P{Q2END}
AND $X{IN,url_txt,SCREENS}
UNION ALL
SELECT
$P{Q3START} as qtr,
url_txt,
user_role_txt,
CASE when user_role_txt = 'Role0' then 1 else 0 end as role0,
CASE when user_role_txt = 'Role1' then 1 else 0 end as role1,
CASE when user_role_txt = 'Role2' then 1 else 0 end as role2,
CASE when user_role_txt = 'Role3' then 1 else 0 end as role3,
CASE when user_role_txt = 'Role4' then 1 else 0 end as role4 from table
where acs_ts::date >= $P{Q3START}
AND acs_ts::date <= $P{Q3END}
AND $X{IN,url_txt,SCREENS}
UNION ALL
SELECT
$P{Q4START} as qtr,
url_txt,
user_role_txt,
CASE when user_role_txt = 'Role0' then 1 else 0 end as role0,
CASE when user_role_txt = 'Role1' then 1 else 0 end as role1,
CASE when user_role_txt = 'Role2' then 1 else 0 end as role2,
CASE when user_role_txt = 'Role3' then 1 else 0 end as role3,
CASE when user_role_txt = 'Role4' then 1 else 0 end as role4 from table
where acs_ts::date >= $P{Q4START}
AND acs_ts::date <= $P{Q4END}
AND $X{IN,url_txt,SCREENS}
) as t
group by t.qtr, t.url_txt,t.user_role_txt]]>
</queryString>
<field name="url_txt" class="java.lang.String"/>
<field name="role0_page" class="java.lang.Integer"/>
<field name="role1_page" class="java.lang.Integer"/>
<field name="role2_page" class="java.lang.Integer"/>
<field name="role3_page" class="java.lang.Integer"/>
<field name="role4_page" class="java.lang.Integer"/>
<field name="user_role_txt" class="java.lang.String"/>
<field name="qtr" class="java.util.Date"/>
<group name="Group1" keepTogether="true">
<groupExpression><![CDATA[$F{url_txt}]]></groupExpression>
</group>
<pageHeader>
<band height="98" splitType="Stretch">
<staticText>
<reportElement key="t_4" mode="Opaque" x="130" y="-1" width="320" height="15" isRemoveLineWhenBlank="true" forecolor="#000000" backcolor="#FFFFFF" uuid="70d07b08-a98f-462f-912c-86e8ca3cffa5">
<property name="net.sf.jasperreports.export.pdf.tag.h1" value="full"/>
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
</reportElement>
<box>
<topPen lineWidth="0.0" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Top">
<font fontName="Arial" size="12" isBold="true"/>
<paragraph lineSpacing="Single"/>
</textElement>
<text><![CDATA[DEL Report]]></text>
</staticText>
<textField pattern="([GENERAL])" isBlankWhenNull="true">
<reportElement key="COMPUTE_5" mode="Opaque" x="140" y="15" width="300" height="15" forecolor="#000000" backcolor="#FFFFFF" uuid="fa243ebd-82b3-426a-8693-995a1d029d8c">
<property name="net.sf.jasperreports.export.pdf.tag.h2"/>
<property name="net.sf.jasperreports.export.pdf.tag.h1" value="full"/>
</reportElement>
<box>
<topPen lineWidth="0.0" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Top">
<font fontName="Arial" size="12" isBold="true"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA["Data Element Library Usage Report"]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="true">
<reportElement key="DATE_1" mode="Opaque" x="430" y="0" width="102" height="12" forecolor="#000000" backcolor="#FFFFFF" uuid="8c30e5fd-4921-4b61-a07d-fec225f73dca">
<property name="net.sf.jasperreports.export.pdf.tag.h2" value="full"/>
<property name="net.sf.jasperreports.export.pdf.tag.h3"/>
</reportElement>
<box>
<topPen lineWidth="0.0" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineColor="#000000"/>
</box>
<textElement verticalAlignment="Top">
<font fontName="Arial" size="8"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA["Run Date: " + new SimpleDateFormat("MM/dd/yyyy").format(new Date())]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="true">
<reportElement key="PAGE_1" mode="Opaque" x="430" y="12" width="40" height="12" forecolor="#000000" backcolor="#FFFFFF" uuid="d3278171-f2e1-4241-b57f-5e4f3fc2ee09">
<property name="net.sf.jasperreports.export.pdf.tag.h2" value="start"/>
<property name="net.sf.jasperreports.export.pdf.tag.h3"/>
</reportElement>
<box>
<topPen lineWidth="0.0" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineColor="#000000"/>
</box>
<textElement verticalAlignment="Top">
<font fontName="Arial" size="8"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA["Page " + $V{PAGE_NUMBER} + " of "]]></textFieldExpression>
</textField>
<textField evaluationTime="Report" pattern="" isBlankWhenNull="true">
<reportElement key="PAGE_1" mode="Transparent" x="470" y="12" width="30" height="12" forecolor="#000000" backcolor="#FFFFFF" uuid="f12aa9ee-4dbb-4569-bad4-1994dcfc045c">
<property name="net.sf.jasperreports.export.pdf.tag.h3"/>
<property name="net.sf.jasperreports.export.pdf.tag.h2" value="end"/>
</reportElement>
<box>
<topPen lineWidth="0.0" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineColor="#000000"/>
</box>
<textElement verticalAlignment="Top">
<font fontName="Arial" size="8"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<image>
<reportElement x="0" y="0" width="150" height="56" uuid="5c21389e-0147-4bab-8b2b-b2462883c4e4">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<imageExpression><![CDATA[$P{CMSLOGO_DIR} + "CMS_logo.jpg"]]></imageExpression>
<hyperlinkTooltipExpression><![CDATA["Centers for Medicare & Medicaid Services"]]></hyperlinkTooltipExpression>
</image>
<staticText>
<reportElement x="0" y="70" width="280" height="12" uuid="9f93ebb5-6ca9-4f7f-be7c-d06093207859">
<property name="net.sf.jasperreports.export.pdf.tag.h3" value="start"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement verticalAlignment="Top">
<font fontName="Arial" isBold="false"/>
</textElement>
<text><![CDATA[Note: * indicates an empty value.]]></text>
</staticText>
<textField>
<reportElement x="140" y="30" width="300" height="20" uuid="c2b0287c-ce1e-461c-aabb-1c6e28b0b30d"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA["From "+$P{START_DATE_RPT}+" to "+$P{END_DATE_RPT}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<detail>
<band height="285">
<barChart>
<chart isShowLegend="true">
<reportElement key="" isPrintRepeatedValues="false" x="0" y="19" width="480" height="245" uuid="55b46114-7361-48b7-8dac-5c40089efb33">
<property name="com.jaspersoft.studio.unit.y" value="inch"/>
</reportElement>
<chartTitle position="Top">
<titleExpression><![CDATA[$F{url_txt}]]></titleExpression>
</chartTitle>
<chartSubtitle/>
<chartLegend position="Right"/>
</chart>
<categoryDataset>
<dataset incrementType="Page"/>
<categorySeries>
<seriesExpression><![CDATA["Role0"]]></seriesExpression>
<categoryExpression><![CDATA[$F{qtr}]]></categoryExpression>
<valueExpression><![CDATA[$F{role0_page}]]></valueExpression>
</categorySeries>
<categorySeries>
<seriesExpression><![CDATA["Role1"]]></seriesExpression>
<categoryExpression><![CDATA[$F{qtr}]]></categoryExpression>
<valueExpression><![CDATA[$F{role1_page}]]></valueExpression>
</categorySeries>
<categorySeries>
<seriesExpression><![CDATA["Role2"]]></seriesExpression>
<categoryExpression><![CDATA[$F{qtr}]]></categoryExpression>
<valueExpression><![CDATA[$F{role2_page}]]></valueExpression>
</categorySeries>
<categorySeries>
<seriesExpression><![CDATA["Role3"]]></seriesExpression>
<categoryExpression><![CDATA[$F{qtr}]]></categoryExpression>
<valueExpression><![CDATA[$F{role3_page}]]></valueExpression>
</categorySeries>
<categorySeries>
<seriesExpression><![CDATA["Role4"]]></seriesExpression>
<categoryExpression><![CDATA[$F{qtr}]]></categoryExpression>
<valueExpression><![CDATA[$F{role4_page}]]></valueExpression>
</categorySeries>
</categoryDataset>
<barPlot>
<plot/>
<itemLabel/>
<categoryAxisLabelExpression><![CDATA["Quarter"]]></categoryAxisLabelExpression>
<categoryAxisFormat>
<axisFormat labelColor="#000000" tickLabelColor="#000000" axisLineColor="#000000"/>
</categoryAxisFormat>
<valueAxisLabelExpression><![CDATA["Page Count"]]></valueAxisLabelExpression>
<valueAxisFormat>
<axisFormat labelColor="#000000" tickLabelColor="#000000" axisLineColor="#000000"/>
</valueAxisFormat>
</barPlot>
</barChart>
</band>
</detail>
</jasperReport>
EDIT: I have gotten all the series on the same chart, fixed due to the different variable name

How to prevent blank page at the end with jasperreports

I have a report containing a table with dynamic content on the left side and a frame containing static fixed size text on the right side:
Below you find the jrxml source (I removed the title and three columns of the table to reduce the size):
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.3.1.final using JasperReports Library version 6.3.1 -->
<!-- 2017-08-10T11:19:14 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="WaterlevelForecastReport" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isSummaryNewPage="true" resourceBundle="messages" whenResourceMissingType="Empty" uuid="3cf70749-5058-4a53-ad3e-091553a6ed3e">
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
<style name="Table_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_CH" mode="Opaque" backcolor="#BFE1FF" hTextAlign="Center" vTextAlign="Middle" isBlankWhenNull="true" fontName="Arial" fontSize="8" isBold="false">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="DataStyle" hTextAlign="Center" isBlankWhenNull="true" fontName="Arial" fontSize="8" isBold="false"/>
<subDataset name="WaterLevelForecastDataSet" uuid="01de13e9-d88f-4fef-b1bf-4de28bf02e6a">
<parameter name="waterlevelForecastData" class="com.example.reporting.WaterlevelForecastReportService.WaterlevelForecastData">
<parameterDescription><![CDATA[]]></parameterDescription>
</parameter>
<field name="waterLevel" class="com.example.WaterLevelForecast">
<fieldDescription><![CDATA[_THIS]]></fieldDescription>
</field>
</subDataset>
<parameter name="logo" class="Object" isForPrompting="false">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[]]>
</queryString>
<field name="waterlevelForecastData" class="com.example.reporting.WaterlevelForecastReportService.WaterlevelForecastData">
<fieldDescription><![CDATA[_THIS]]></fieldDescription>
</field>
<detail>
<band height="200">
<frame>
<reportElement x="0" y="0" width="100" height="42" uuid="a532b32e-a9e0-427b-84c4-d60fe9589d84">
<property name="local_mesure_unitx" value="pixel"/>
<property name="com.jaspersoft.studio.unit.x" value="px"/>
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="local_mesure_unity" value="pixel"/>
<property name="com.jaspersoft.studio.unit.y" value="px"/>
</reportElement>
<componentElement>
<reportElement x="0" y="0" width="100" height="42" isRemoveLineWhenBlank="true" uuid="f4166ea1-a21d-4ed8-8f16-02ae243c81f1">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
<property name="com.jaspersoft.studio.table.style.table_header" value="Table_TH"/>
<property name="com.jaspersoft.studio.table.style.column_header" value="Table_CH"/>
<property name="com.jaspersoft.studio.table.style.detail" value="Table_TD"/>
<property name="net.sf.jasperreports.export.headertoolbar.table.name" value=""/>
<property name="com.jaspersoft.studio.unit.x" value="pixel"/>
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="WaterLevelForecastDataSet" uuid="15b7c136-4802-4b6b-bd8c-cbde01ec9bed">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{waterlevelForecastData}.getWaterlevelForecastList())]]></dataSourceExpression>
</datasetRun>
<jr:column width="100" uuid="d70db54d-dd19-40c3-a36c-1d9592008fcc">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/>
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<staticText>
<reportElement style="Table_CH" x="0" y="0" width="100" height="30" uuid="7fa06c16-b4cc-450e-a204-6fe97e18c1a4">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<text><![CDATA[Datum]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="12">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<textField isStretchWithOverflow="true">
<reportElement style="DataStyle" x="0" y="0" width="100" height="12" uuid="75c92bc7-279f-4ea5-95dd-2005b43669f2">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textFieldExpression><![CDATA[new java.text.SimpleDateFormat("E dd.MM.yyyy", $P{REPORT_LOCALE}).format($F{waterLevel}.getTime())]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</frame>
<frame>
<reportElement positionType="Float" x="570" y="0" width="230" height="200" uuid="386949ed-e289-4e9d-82af-54f7a1afbb6e"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<staticText>
<reportElement style="DataStyle" x="11" y="11" width="59" height="12" uuid="a63c6262-34f9-4731-9ad4-22bf6a2a54d2"/>
<textElement textAlignment="Left"/>
<text><![CDATA[Pegelort:]]></text>
</staticText>
<staticText>
<reportElement style="DataStyle" x="11" y="31" width="59" height="12" uuid="d56daa72-b14f-442b-8868-4bba5601f47f"/>
<textElement textAlignment="Left"/>
<text><![CDATA[Position:]]></text>
</staticText>
<staticText>
<reportElement style="DataStyle" x="11" y="51" width="58" height="12" uuid="056f6c4b-375e-4d88-8aa4-900da296b655"/>
<textElement textAlignment="Left"/>
<text><![CDATA[MHW (mPN):]]></text>
</staticText>
<staticText>
<reportElement style="DataStyle" x="11" y="71" width="57" height="12" uuid="30d9f8de-2612-4c2a-b319-39b01f6d2809"/>
<textElement textAlignment="Left"/>
<text><![CDATA[MNW (mPN):]]></text>
</staticText>
<staticText>
<reportElement style="DataStyle" x="11" y="91" width="57" height="12" uuid="51b3bc61-c9f3-4b48-9f72-df980ea80c2e"/>
<textElement textAlignment="Left"/>
<text><![CDATA[PN (mNN):]]></text>
</staticText>
<staticText>
<reportElement style="DataStyle" x="11" y="111" width="218" height="12" uuid="ddaea131-e7f8-4215-bada-f489b37896a9"/>
<textElement textAlignment="Left"/>
<text><![CDATA[Der Wasserstand bezieht sich auf Pegelnull.]]></text>
</staticText>
<staticText>
<reportElement style="DataStyle" x="11" y="123" width="29" height="12" uuid="54323c5e-1213-441f-9bda-41b6415d9158"/>
<textElement textAlignment="Left"/>
<text><![CDATA[HW]]></text>
</staticText>
<staticText>
<reportElement style="DataStyle" x="11" y="135" width="29" height="12" uuid="9974d608-8a33-4f35-ae72-07388f9ae138"/>
<textElement textAlignment="Left"/>
<text><![CDATA[NW]]></text>
</staticText>
<staticText>
<reportElement style="DataStyle" x="11" y="147" width="29" height="12" uuid="428c7ee2-46c1-4008-b355-8ac357c51057"/>
<textElement textAlignment="Left"/>
<text><![CDATA[MHW]]></text>
</staticText>
<staticText>
<reportElement style="DataStyle" x="11" y="159" width="29" height="12" uuid="81b95147-96f0-4227-b9a9-cf51c5db0c8c"/>
<textElement textAlignment="Left"/>
<text><![CDATA[MNW]]></text>
</staticText>
<staticText>
<reportElement style="DataStyle" x="11" y="183" width="29" height="12" uuid="38ef4fc2-05dd-4aae-8510-c50002d2492e"/>
<textElement textAlignment="Left"/>
<text><![CDATA[NN]]></text>
</staticText>
<staticText>
<reportElement style="DataStyle" x="11" y="171" width="29" height="12" uuid="8c9e77a4-65ea-4ef4-b8e4-b4b3620c3f0e"/>
<textElement textAlignment="Left"/>
<text><![CDATA[PN]]></text>
</staticText>
<staticText>
<reportElement style="DataStyle" x="40" y="123" width="160" height="12" uuid="66fd279e-95db-4970-b70f-aaa298929472"/>
<textElement textAlignment="Left"/>
<text><![CDATA[= Hochwasser]]></text>
</staticText>
<staticText>
<reportElement style="DataStyle" x="40" y="135" width="160" height="12" uuid="03b13ac8-169c-419c-a407-749b41c55f4a"/>
<textElement textAlignment="Left"/>
<text><![CDATA[= Niedrigwasser]]></text>
</staticText>
<staticText>
<reportElement style="DataStyle" x="40" y="147" width="160" height="12" uuid="f5bc3c27-f772-44d7-8679-f69a52d0f3e8"/>
<textElement textAlignment="Left"/>
<text><![CDATA[= Mittleres Hochwasser]]></text>
</staticText>
<staticText>
<reportElement style="DataStyle" x="40" y="159" width="160" height="12" uuid="8124681f-f321-4cde-986b-458318ef925f"/>
<textElement textAlignment="Left"/>
<text><![CDATA[= Mittleres Niedrigwasser]]></text>
</staticText>
<staticText>
<reportElement style="DataStyle" x="40" y="171" width="160" height="12" uuid="8bd1a23e-b9a6-48c9-afc3-8d01a901327a"/>
<textElement textAlignment="Left"/>
<text><![CDATA[= Pegelnull]]></text>
</staticText>
<staticText>
<reportElement style="DataStyle" x="40" y="183" width="160" height="12" uuid="96bb6dce-c1cd-490b-93f5-5aca18234fe2"/>
<textElement textAlignment="Left"/>
<text><![CDATA[= Normalnull]]></text>
</staticText>
</frame>
</band>
</detail>
<pageFooter>
<band height="30">
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" x="0" y="10" width="800" height="20" uuid="0d80af3a-fdab-42df-a876-9debf03164e8">
<property name="local_mesure_unitx" value="pixel"/>
<property name="local_mesure_unity" value="pixel"/>
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement>
<font fontName="Arial" size="7"/>
</textElement>
<textFieldExpression><![CDATA[$R{label.hvcc.disclaimer}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
If I generate a PDF file from this report template, I'm always getting a blank page at the end, containing only the page footer and no content.
For my understanding this is because of the space between the table on the left side and the bottom of detail band 1, that will be added to the end of the table when the report is generated. So if the table and the space below is to large for one page, an additional page is added to the PDF containing only the space and footer.
If I remove the frame on the right side and reduce the height of detail band 1 to the end of the table, everything is fine and no extra page will be added. But I need this space in the report template because of the frame on the right side containing the static text.
How can I change the report template to reduce the height of detail band 1, so that no space below the table will be added to the PDF but with no effect to the definition of the frame on the right side?
I tried it many times by changing the stretch and overflow options but I'm always getting a blank page at the end.
Workaround
If I use a subreport for the frame on the right side and setting the height of the subreport element to the same height of the table on the left side, the height of detail band 1 can be reduced to the end of table and in the generated report no space will be added after the table and no extra page will be rendered.
But I thought there is a possibility to achieve this without using subreports.

jaspersoft report bar graph

I have a query as below. I'd like to display number of requests for the 3 consecutive fiscal years (FY1, FY2, FY3). The bar graph only shows data for FY1. How do I display 3 bars within the graph?
select count(unique(p1.requestNumber)) as FY1, count(unique(p2.requestNumber)) as FY2, count(unique(p3.requestNumber)) as FY3
from fd.bankRequest P1, fd.bankRequest P2, fd.bankRequest P3
where
to_char(P1.requestDate, 'yyyymm') between (to_char(sysdate, 'yyyy')|| '10') and to_char(sysdate, 'yyyymm')
and
(to_char(P2.requestDate, 'yyyymm') between (to_number(to_char(sysdate, 'yyyy') -1) || '10') and (to_char(sysdate, 'yyyy') || '09'))
and
(to_char(P3.requestDate, 'yyyymm') between (to_number(to_char(sysdate, 'yyyy') -2) || '10') and (to_number(to_char(sysdate, 'yyyy') -1) || '09'))
and
to_number(to_char(sysdate, 'mm')) >= 10
The jrxml codes as below
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.2.1.final using JasperReports Library version 6.2.1 -->
<!-- 2016-11-23T12:32:37 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="FYRpt" language="groovy" pageWidth="612" pageHeight="792" whenNoDataType="AllSectionsNoDetail" columnWidth="572" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isSummaryWithPageHeaderAndFooter="true" isIgnorePagination="true" uuid="8a465670-cc4a-4270-965f-8efb86e33b71">
<property name="template.engine" value="tabular_template"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="ojdbc7"/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
<style name="Table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
<topPen lineWidth="1.0" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="Table_TH" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table 1_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table 2_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table 3_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table 3_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table 3_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="FiscalYear" uuid="653c97d8-f01f-433a-8f37-19831ca0c04e">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="ojdbc7"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<queryString>
<![CDATA[select count(unique(p1.requestNumber)) as FY1, count(unique(p2.requestNumber)) as FY2, count(unique(p3.requestNumber)) as FY3
from fd.bankRequest P1, fd.bankRequest P2, fd.bankRequest P3
where
to_char(P1.requestDate, 'yyyymm') between (to_char(sysdate, 'yyyy')|| '10') and to_char(sysdate, 'yyyymm')
and
(to_char(P2.requestDate, 'yyyymm') between (to_number(to_char(sysdate, 'yyyy') -1) || '10') and (to_char(sysdate, 'yyyy') || '09'))
and
(to_char(P3.requestDate, 'yyyymm') between (to_number(to_char(sysdate, 'yyyy') -2) || '10') and (to_number(to_char(sysdate, 'yyyy') -1) || '09'))
and
to_number(to_char(sysdate, 'mm')) >= 10]]>
</queryString>
<field name="FY1" class="java.math.BigDecimal"/>
<field name="FY2" class="java.math.BigDecimal"/>
<field name="FY3" class="java.math.BigDecimal"/>
</subDataset>
<queryString>
<![CDATA[]]>
</queryString>
<title>
<band height="60" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<image>
<reportElement x="0" y="0" width="222" height="36" uuid="a9fbad6a-651d-43cd-bfb6-2cf334d623ed"/>
<imageExpression><![CDATA["C:/jboss-eap-6.4/NX-runtime/reports/Images/Logo.png"]]></imageExpression>
</image>
<staticText>
<reportElement x="280" y="0" width="209" height="30" uuid="4d5423b2-708b-4afa-9ffd-f7ce5b8135f6"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font size="14" isBold="true"/>
</textElement>
<text><![CDATA[Executive Summary]]></text>
</staticText>
<textField isStretchWithOverflow="true" pattern="">
<reportElement x="380" y="30" width="191" height="20" forecolor="#000000" uuid="d770f29c-b0d4-4161-87d6-db5a2c36754e">
<property name="com.jaspersoft.studio.unit.y" value="pixel"/>
</reportElement>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="11"/>
</textElement>
<textFieldExpression><![CDATA["Report created on " + new SimpleDateFormat("MM/dd/yyyy HH:mm").format(new Date())]]></textFieldExpression>
</textField>
</band>
</title>
<pageFooter>
<band height="65">
<textField>
<reportElement positionType="Float" x="210" y="40" width="361" height="20" uuid="6ca8797f-653d-46a0-a24f-d286078dccc8"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="11"/>
</textElement>
<textFieldExpression><![CDATA["Page " + $V{PAGE_NUMBER} + " of " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band height="581" splitType="Stretch">
<property name="local_mesure_unitheight" value="pixel"/>
<textField>
<reportElement x="10" y="0" width="570" height="20" uuid="8956e672-accf-461b-b2b1-e81f70e8e87e">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Fiscal Year Report"]]></textFieldExpression>
</textField>
<componentElement>
<reportElement x="10" y="50" width="200" height="120" uuid="eba4eb25-553f-424c-aba2-c124b35957cb">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
<property name="com.jaspersoft.studio.table.style.table_header" value="Table 3_TH"/>
<property name="com.jaspersoft.studio.table.style.column_header" value="Table 3_CH"/>
<property name="com.jaspersoft.studio.table.style.detail" value="Table 3_TD"/>
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="FiscalYear" uuid="e5979756-be6d-498c-8502-b9217b605591">
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column width="110" uuid="b11b4e94-29e6-497e-8534-55832acd42d9">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/>
<jr:tableFooter style="Table 3_TH" height="30" rowSpan="1">
<textField>
<reportElement mode="Opaque" x="0" y="0" width="110" height="30" uuid="e1165115-bb42-4a58-bb64-96782790ae11"/>
<box leftPadding="6"/>
<textElement verticalAlignment="Middle">
<font fontName="Times New Roman" size="11"/>
</textElement>
<textFieldExpression><![CDATA["FY " + new SimpleDateFormat("yyyy").format(org.apache.commons.lang.time.DateUtils.addYears(TODAY( ),1))]]></textFieldExpression>
</textField>
</jr:tableFooter>
<jr:columnHeader style="Table 3_CH" height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="110" height="30" uuid="a5e2a06a-8ab3-471b-82a1-dd9288957ede"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Fiscal Year (FY)]]></text>
</staticText>
</jr:columnHeader>
<jr:columnFooter style="Table 3_CH" height="30" rowSpan="1">
<textField>
<reportElement mode="Opaque" x="0" y="0" width="110" height="30" uuid="61a4651f-cb1d-416f-a32e-68beb2d1c219"/>
<box leftPadding="6"/>
<textElement verticalAlignment="Middle">
<font fontName="Times New Roman" size="11"/>
</textElement>
<textFieldExpression><![CDATA["FY " + YEAR(TODAY())]]></textFieldExpression>
</textField>
</jr:columnFooter>
<jr:detailCell style="Table 3_TD" height="30">
<textField>
<reportElement mode="Opaque" x="0" y="0" width="110" height="30" uuid="6eb9c024-cc8f-4810-bf96-22de20b8eca7"/>
<box leftPadding="6"/>
<textElement verticalAlignment="Middle">
<font fontName="Times New Roman" size="11"/>
</textElement>
<textFieldExpression><![CDATA["FY " + new SimpleDateFormat("yyyy").format(org.apache.commons.lang.time.DateUtils.addYears(TODAY( ),-1))]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="a0501979-12d2-43ab-9f50-c3a0814888c4">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
<jr:tableFooter style="Table 3_TH" height="30" rowSpan="1">
<textField>
<reportElement mode="Opaque" x="0" y="0" width="90" height="30" forecolor="#000000" uuid="d1c24563-2f4c-4948-92a5-507a91344541"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="11"/>
</textElement>
<textFieldExpression><![CDATA[$F{FY3}]]></textFieldExpression>
</textField>
</jr:tableFooter>
<jr:columnHeader style="Table 3_CH" height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="90" height="30" uuid="64033655-a2a1-4260-84bb-940d2e71fcc1"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Total Requests]]></text>
</staticText>
</jr:columnHeader>
<jr:columnFooter style="Table 3_CH" height="30" rowSpan="1">
<textField>
<reportElement mode="Opaque" x="0" y="0" width="90" height="30" uuid="43b0b490-b093-482f-a6b5-6473ffa4ba6d"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="11"/>
</textElement>
<textFieldExpression><![CDATA[$F{FY2}]]></textFieldExpression>
</textField>
</jr:columnFooter>
<jr:detailCell style="Table 3_TD" height="30">
<textField>
<reportElement mode="Opaque" x="0" y="0" width="90" height="30" uuid="00bdeea7-5bea-4d71-8ef7-29cf59c25df6"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="11"/>
</textElement>
<textFieldExpression><![CDATA[$F{FY1}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
<barChart>
<chart evaluationTime="Report" theme="eye.candy.sixties">
<reportElement x="240" y="50" width="322" height="190" uuid="91806aa7-467e-4cf4-a723-e6de7db10c18"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<categoryDataset>
<dataset>
<datasetRun subDataset="FiscalYear" uuid="f3908198-41a0-41b6-99d5-0af1af893936">
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
</dataset>
<categorySeries>
<seriesExpression><![CDATA["FY " + new SimpleDateFormat("yyyy").format(org.apache.commons.lang.time.DateUtils.addYears(TODAY( ),-1))]]></seriesExpression>
<categoryExpression><![CDATA[($F{FY1} ? "FY" + new SimpleDateFormat("yyyy").format(org.apache.commons.lang.time.DateUtils.addYears(TODAY( ),-1))
: $F{FY2} ? "FY " + YEAR(TODAY())
: "FY " + new SimpleDateFormat("yyyy").format(org.apache.commons.lang.time.DateUtils.addYears(TODAY( ),1)))]]></categoryExpression>
<valueExpression><![CDATA[$F{FY1}]]></valueExpression>
</categorySeries>
<categorySeries>
<seriesExpression><![CDATA["FY " + YEAR(TODAY())]]></seriesExpression>
<categoryExpression><![CDATA[0]]></categoryExpression>
<valueExpression><![CDATA[0]]></valueExpression>
</categorySeries>
<categorySeries>
<seriesExpression><![CDATA["FY " + new SimpleDateFormat("yyyy").format(org.apache.commons.lang.time.DateUtils.addYears(TODAY( ),1))]]></seriesExpression>
<categoryExpression><![CDATA[0]]></categoryExpression>
<valueExpression><![CDATA[0]]></valueExpression>
</categorySeries>
</categoryDataset>
<barPlot isShowLabels="true">
<plot/>
<itemLabel/>
<categoryAxisFormat>
<axisFormat/>
</categoryAxisFormat>
<valueAxisFormat>
<axisFormat/>
</valueAxisFormat>
</barPlot>
</barChart>
</band>
</summary>
</jasperReport>

How to get the text field present in detail band in the same page or next page in jasper reports [duplicate]

This question already has an answer here:
How do I place a record into a new page in JasperReports if it overflows the last one?
(1 answer)
Closed 7 years ago.
I have a detail band in my ireport which consists of 12 text fields.In those 12 text fields i have "Address" text field as a large one So when i am entering details it is getting the data in report but when it comes to last part of a page then it is breaking the text field into two equal halves.For better understanding i will post an image
As you can see in the image the "Address" text field is broken into two halfs and it is printing the same fields two times,once the address field as half and second the address field as another half.So my question is how to get the entire 12 fields automatically into a page(that may be next page or on the same page with the entire data in one page). I am posting jrxml code below
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report10" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="762" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isSummaryWithPageHeaderAndFooter="true" uuid="d56b6955-1d4c-438c-af7d-059ffd618835">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="92"/>
<property name="ireport.y" value="0"/>
<property name="net.sf.jasperreports.export.xls.white.page.background" value="true"/>
<parameter name="sql" class="java.lang.String"/>
<queryString>
<![CDATA[$P!{sql}]]>
</queryString>
<field name="id" class="java.lang.Long">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="Name" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="Email" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="Company_Name" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="Contact_Person" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="Address" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="Phone" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="Company_Email" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="Review" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="Lead_Date" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="Lead_Details" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="Lead_Value" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="Followup_Date" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="Status" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="Category" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<columnHeader>
<band height="117" splitType="Stretch">
<staticText>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="115" y="71" width="62" height="46" uuid="129f511e-4bb9-4dd9-b3cd-4b190096e88c">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="false"/>
<property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>
</reportElement>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="9" isBold="true" pdfFontName="Times-Bold" pdfEncoding="Cp1250" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Lead_Details]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="177" y="71" width="53" height="46" uuid="88c5b42a-2d36-453b-9c9a-17ffaf1af488">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="false"/>
<property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>
</reportElement>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="9" isBold="true" pdfFontName="Times-Bold" pdfEncoding="Cp1250" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Lead_Value]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="230" y="71" width="64" height="46" uuid="ed5b14db-7054-4fee-b2fc-db6ca2241ca1">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="false"/>
<property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>
</reportElement>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="9" isBold="true" pdfFontName="Times-Bold" pdfEncoding="Cp1250" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Contact_Person]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="294" y="71" width="64" height="46" uuid="73767c90-ebbc-44ae-aa94-9df36e11c30b">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="false"/>
<property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>
</reportElement>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="9" isBold="true" pdfFontName="Times-Bold" pdfEncoding="Cp1250" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Phone]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="449" y="71" width="142" height="46" uuid="3351cfa8-ee69-45d9-98ec-d777f4ba34bb">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="false"/>
<property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>
</reportElement>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="9" isBold="true" pdfFontName="Times-Bold" pdfEncoding="Cp1250" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Address]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="591" y="71" width="56" height="46" uuid="ffb8238b-2412-4a2a-a66b-1c70a5e01d2b">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="false"/>
<property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>
</reportElement>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="9" isBold="true" pdfFontName="Times-Bold" pdfEncoding="Cp1250" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[lead_Date]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="647" y="71" width="56" height="46" uuid="f7706746-544f-4344-9500-0a7767fdb0a1">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="false"/>
<property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>
</reportElement>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="9" isBold="true" pdfFontName="Times-Bold" pdfEncoding="Cp1250" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Review]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="703" y="71" width="62" height="46" uuid="f7f9ec1b-3b8b-48e6-907e-7bb182023caa">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="false"/>
<property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>
</reportElement>
<box>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="9" isBold="true" pdfFontName="Times-Bold" pdfEncoding="Cp1250" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Followup_Date]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="765" y="71" width="37" height="46" uuid="0ad2fe4f-63d8-4ccf-9d91-f30932db0ab7">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="false"/>
<property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>
</reportElement>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="9" isBold="true" pdfFontName="Times-Bold" pdfEncoding="Cp1250" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Status]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="37" y="71" width="78" height="46" uuid="3042b27b-209e-45d5-88a9-fc8e6bdd1ad1">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="false"/>
<property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>
</reportElement>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="9" isBold="true" pdfFontName="Times-Bold" pdfEncoding="Cp1250" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Company_Name]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="71" width="37" height="46" uuid="11b0ebc8-3acc-4eca-b6ab-bade1018626c">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="false"/>
<property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>
</reportElement>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="9" isBold="true" pdfFontName="Times-Bold" pdfEncoding="Cp1250" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Name]]></text>
</staticText>
<staticText>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="358" y="71" width="91" height="46" isPrintWhenDetailOverflows="true" uuid="d68bbc76-ddcc-4e8e-a849-9f4b8ed18890">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="false"/>
<property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>
</reportElement>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="9" isBold="true" pdfFontName="Times-Bold" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Company_Email]]></text>
</staticText>
<staticText>
<reportElement x="330" y="0" width="100" height="33" uuid="5f3da1a4-9c04-4580-b25d-bace6758d64a"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="15" isBold="true"/>
</textElement>
<text><![CDATA[Lead Details]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="31" splitType="Stretch">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="37" height="31" isPrintWhenDetailOverflows="true" uuid="549ab824-ce1b-4d92-8a62-29d80d9d9431">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="false"/>
<property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>
</reportElement>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="10" pdfFontName="Times-Roman" pdfEncoding="Cp1250" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{Name}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="37" y="0" width="78" height="31" isPrintWhenDetailOverflows="true" uuid="80cad50c-fb9c-414e-9996-990ebdb8435f">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="false"/>
<property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>
</reportElement>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="10" pdfFontName="Times-Roman" pdfEncoding="Cp1250" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{Company_Name}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="230" y="0" width="64" height="31" isPrintWhenDetailOverflows="true" uuid="b1937422-a70b-4fa9-a637-13515e970213">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="false"/>
<property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>
</reportElement>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="10" pdfFontName="Times-Roman" pdfEncoding="Cp1250" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{Contact_Person}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="449" y="0" width="142" height="31" isPrintWhenDetailOverflows="true" uuid="29c9fc1b-7b0c-4c88-bad3-3be577dfeb06">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="false"/>
<property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>
</reportElement>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="10" pdfFontName="Times-Roman" pdfEncoding="Cp1250" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{Address}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="294" y="0" width="64" height="31" isPrintWhenDetailOverflows="true" uuid="a3a0d8b6-e00b-48c9-a93d-9f368b77ae6f">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="false"/>
<property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>
</reportElement>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="10" pdfFontName="Times-Roman" pdfEncoding="Cp1250" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{Phone}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="358" y="0" width="91" height="31" isPrintWhenDetailOverflows="true" uuid="5ec9fef3-3509-47a4-96ae-8fe6dc0bd440">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="false"/>
<property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>
</reportElement>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{Company_Email}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="591" y="0" width="56" height="31" isPrintWhenDetailOverflows="true" uuid="041239c9-9a1b-4815-816d-5bab4c2150ed">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="false"/>
<property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>
</reportElement>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="10" pdfFontName="Times-Roman" pdfEncoding="Cp1250" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{Lead_Date}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="115" y="0" width="62" height="31" isPrintWhenDetailOverflows="true" uuid="3e6d8ab4-9257-481b-8c58-4f1e6058fe1d">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="false"/>
<property name="net.sf.jasperreports.export.pdf.auto.fit.row" value="true"/>
</reportElement>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="10" pdfFontName="Times-Roman" pdfEncoding="Cp1250" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{Lead_Details}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="177" y="0" width="53" height="31" isPrintWhenDetailOverflows="true" uuid="51d984bd-3e90-4879-838a-93a09c5866cf">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="false"/>
<property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>
</reportElement>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="10" pdfFontName="Times-Roman" pdfEncoding="Cp1250" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{Lead_Value}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="765" y="0" width="37" height="31" isPrintWhenDetailOverflows="true" uuid="343a31be-2382-4cc7-8f56-c17d9c1f6325">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="false"/>
<property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>
</reportElement>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="10" pdfFontName="Times-Roman" pdfEncoding="Cp1250" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{Status}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="703" y="0" width="62" height="31" isPrintWhenDetailOverflows="true" uuid="3a9c7a9b-77bf-4b74-a119-4076fbbe9907">
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="false"/>
<property name="net.sf.jasperreports.export.pdf.force.linebreak.policy" value="true"/>
</reportElement>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="10" pdfFontName="Times-Roman" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{Followup_Date}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="647" y="0" width="56" height="31" isPrintWhenDetailOverflows="true" uuid="36caba9f-b250-455a-821b-f3cf67ffbf59"/>
<box>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" pdfFontName="Times-Roman" isPdfEmbedded="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{Review}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
Try setting splitType="Prevent" attribute for Detail band:
<detail>
<band height="31" splitType="Prevent">
I found out an answer which is correct or not i dont know.I tried like this.I put in detail band Splittype=prevent instead of stretch.

Multiple rows inside a single column in jasper table

I am just a beginner in jasper report and i am stuck for a few days in a problem.
I have two tables
Medication {ID,medication_name}
and
dose_time{ID,medication_id,dose_time}
Applying
SELECT m.id,m.medication_name,d_t.dose_time FROM medication `m`
LEFT JOIN dose_time d_t ON m.id=d_t.medication_id;
gives me three result
Now what i want is following jasper report
But i could stuck and can generate only following jasper format
My jrxml file is as follow
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="PracticeReport" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="67dfb372-a5be-403b-9007-61ab07fe88e7">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<subDataset name="Medication" uuid="1cccb880-701b-491e-8094-c133d4bd3819">
<queryString>
<![CDATA[SELECT m.id,m.medication_name,d_t.dose_time FROM medication `m`
LEFT JOIN dose_time d_t ON m.id=d_t.medication_id;]]>
</queryString>
<field name="id" class="java.lang.Integer">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="medication_name" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="dose_time" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<group name="id">
<groupExpression><![CDATA[$F{id}]]></groupExpression>
</group>
</subDataset>
<title>
<band height="79" splitType="Stretch">
<staticText>
<reportElement uuid="8bc54002-3e51-4bd6-8801-9856ef627b99" x="154" y="28" width="240" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Practicing Jasper]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="61" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="125" splitType="Stretch">
<componentElement>
<reportElement uuid="5976a679-e65a-4880-a9e7-74fd65f9e80d" key="" isPrintRepeatedValues="false" x="0" y="0" width="555" height="125">
<printWhenExpression><![CDATA[$V{REPORT_COUNT}==1]]></printWhenExpression>
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" whenNoDataType="AllSectionsNoDetail">
<datasetRun subDataset="Medication" uuid="5f6c54e4-9c5c-4120-8ac7-32793ec39d00"/>
<jr:column width="232" uuid="c5a6dca0-3be4-422f-8f13-4462d2e4caee">
<jr:detailCell height="124" rowSpan="1">
<textField>
<reportElement uuid="080e50f3-23a0-4bf2-8d6f-b63618dfdc51" isPrintRepeatedValues="false" x="0" y="0" width="232" height="124"/>
<box>
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement/>
<textFieldExpression><![CDATA[$F{id} + ","+$F{medication_name}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="232" uuid="b7bef864-31db-4b77-a929-a0d59e754b36">
<jr:detailCell height="124" rowSpan="1">
<textField>
<reportElement uuid="7b3c68b6-6048-4690-b8e7-14a286f94297" x="0" y="0" width="232" height="124"/>
<box>
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement/>
<textFieldExpression><![CDATA[$F{dose_time}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
Please guys i need your help.
You can use a crosstab for that. Go to Window and click on Palette. Than the palette will appear right. Finally, drag 'crosstab' to the summary section and fill in the wizard.
This might be of some help https://community.jaspersoft.com/wiki/how-merge-table-rows-repeated-values
In this solution, 2 datasets are used, the first dataset groups the data while the second dataset is used to create a table which is embedded in a band.
Edit: I applied another approach to do this. I used a table for the entire thing. The first column of the table is for the medicine and contains a textfield. The second column of the table is for the timing. It is a sub report and the sub report in turn contains another table with the timing.
I didn't use SQL but created a manual data in java. Here is my java code.
import static com.vroozi.api.requests.util.JasperUtils.compileJrxmlToJasper;
import com.vroozi.api.requests.util.JasperUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import org.springframework.stereotype.Service;
#Service
public class PDFServiceImpl {
public String generate() throws JRException {
final String format = DATE_TIME_FORMAT.format(new Date());
final String outputFileName = String.format("PO_%s_%s_PDF.pdf", "rajshree", format);
final String purchaseReportsPath = "/home/oem";
Map<String, Object> parameters = new HashMap<>();
Map<String, Object> cetamolMap = new HashMap<>();
cetamolMap.put("medicine", "Cetamol");
Map<String, Object> painKillerMap = new HashMap<>();
painKillerMap.put("medicine", "Pain killer");
List<Map<String, Object>> medicineMapList = Arrays.asList(cetamolMap, painKillerMap);
Map<String, Object> time1 = new HashMap<>();
time1.put("time", "11 a.m.");
Map<String, Object> time2 = new HashMap<>();
time2.put("time", "2 p.m.");
List<Map<String, Object>> timeMapList = Arrays.asList(time1, time2);
cetamolMap.put("timeList", new JRBeanCollectionDataSource(timeMapList));
painKillerMap.put("timeList", new JRBeanCollectionDataSource(new ArrayList<>()));
// Adding subreport for each medicine
cetamolMap.put("timeTableSubReport",
compileJrxmlToJasper("/subreport.jrxml"));
painKillerMap.put("timeTableSubReport",
compileJrxmlToJasper("/reports/subreport.jrxml"));
parameters.put("medicineMapList", new JRBeanCollectionDataSource(medicineMapList));
return JasperUtils.generatePdfReport("/reports/report.jrxml",
parameters, purchaseReportsPath, outputFileName);
}
}
Here is the "report.jrxml"
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="catalogPOCR" pageWidth="559" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="559" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" whenResourceMissingType="Empty" uuid="42c67c01-6232-438f-8149-de04399dfcd2">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="ireport.scriptlethandling" value="0"/>
<property name="ireport.encoding" value="UTF-8"/>
<import value="net.sf.jasperreports.engine.*"/>
<import value="org.apache.commons.collections.CollectionUtils"/>
<import value="java.util.*"/>
<import value="net.sf.jasperreports.engine.data.*"/>
<style name="table 1">
<box>
<pen lineWidth="0.0" lineColor="#000000"/>
</box>
</style>
<style name="table 1_TH" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.0" lineColor="#000000"/>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
</style>
<style name="table 1_CH" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.0" lineColor="#000000"/>
</box>
</style>
<style name="table 1_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.0" lineColor="#000000"/>
</box>
<conditionalStyle>
<conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression>
<style backcolor="#FFFFFF"/>
</conditionalStyle>
</style>
<subDataset name="Table LineItems" uuid="183918c2-b66e-4347-ae7b-e891ab0a1d88">
<field name="medicine" class="java.lang.String"/>
<field name="timeTableSubReport" class="net.sf.jasperreports.engine.JasperReport"/>
<field name="timeList" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/>
</subDataset>
<subDataset name="Dataset1" uuid="183918c2-b66e-4347-ae7b-e891ab0a1d88">
<field name="order" class="java.lang.String"/>
</subDataset>
<parameter name="medicineMapList" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/>
<parameter name="timeTableSubReport" class="net.sf.jasperreports.engine.JasperReport" isForPrompting="false"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band splitType="Stretch"/>
</title>
<detail>
<band height="170">
<componentElement>
<reportElement key="table 1" style="table 1" positionType="Float" x="0" y="0" width="504" height="70" uuid="eb4057df-dd6a-40dd-870e-baac8c8afe17">
<property name="local_mesure_unitwidth" value="inch"/>
<property name="com.jaspersoft.studio.unit.width" value="inch"/>
<printWhenExpression><![CDATA[$V{REPORT_COUNT} == 1]]></printWhenExpression>
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="Table LineItems" uuid="8a44aec8-cdd4-4be3-b47a-620e00bb910a">
<datasetParameter name="REPORT_DATA_SOURCE">
<datasetParameterExpression><![CDATA[$P{medicineMapList}]]></datasetParameterExpression>
</datasetParameter>
</datasetRun>
<jr:column width="70" uuid="baa7f786-d12a-4234-b9d7-faef6c9f25df">
<jr:detailCell style="table 1_TD" height="20" rowSpan="1">
<box>
<pen lineWidth="0.0"/>
<topPen lineWidth="0.0"/>
<leftPen lineWidth="0.0"/>
<bottomPen lineWidth="0.0"/>
<rightPen lineWidth="0.0"/>
</box>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="70" height="20" uuid="5f84b7ac-c2fe-4426-b91f-6714b470a2bc"/>
<box topPadding="5" leftPadding="2" bottomPadding="5" rightPadding="2">
<topPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="8" isBold="false"/>
<paragraph rightIndent="4"/>
</textElement>
<textFieldExpression><![CDATA[$F{medicine}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="70" uuid="baa7f786-d12a-4234-b9d7-faef6c9f25df">
<jr:detailCell style="table 1_TD" height="20" rowSpan="1">
<box>
<pen lineWidth="0.0"/>
<topPen lineWidth="0.0"/>
<leftPen lineWidth="0.0"/>
<bottomPen lineWidth="0.0"/>
<rightPen lineWidth="0.0"/>
</box>
<frame>
<reportElement positionType="Float" isPrintRepeatedValues="false" x="0" y="0" width="50" height="20" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="true" uuid="62f0ab9e-28c4-4a58-935b-f98d26d600e3">
<property name="ShowOutOfBoundContent" value="false"/>
</reportElement>
<subreport>
<reportElement positionType="Float" x="0" y="0" width="50" height="20" uuid="48a7bbe4-b8ce-4a0d-a6e1-6ddd288e5602"/>
<parametersMapExpression><![CDATA[$P{REPORT_PARAMETERS_MAP}]]></parametersMapExpression>
<subreportParameter name="timeList">
<subreportParameterExpression><![CDATA[$F{timeList}]]></subreportParameterExpression>
</subreportParameter>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource()]]></dataSourceExpression>
<subreportExpression><![CDATA[$F{timeTableSubReport}]]></subreportExpression>
</subreport>
</frame>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</detail>
<columnFooter>
<band splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band splitType="Stretch"/>
</pageFooter>
<summary>
<band splitType="Stretch"/>
</summary>
</jasperReport>
Here is the subreport.jrxml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="timeTableSubReport" pageWidth="559" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="559" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" whenResourceMissingType="Empty" uuid="42c67c01-6232-438f-8149-de04399dfcd2">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="ireport.scriptlethandling" value="0"/>
<property name="ireport.encoding" value="UTF-8"/>
<import value="net.sf.jasperreports.engine.*"/>
<import value="org.apache.commons.collections.CollectionUtils"/>
<import value="java.util.*"/>
<import value="net.sf.jasperreports.engine.data.*"/>
<style name="table 1">
<box>
<pen lineWidth="0.0" lineColor="#000000"/>
</box>
</style>
<style name="table 1_TH" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.0" lineColor="#000000"/>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
</style>
<style name="table 1_CH" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.0" lineColor="#000000"/>
</box>
</style>
<style name="table 1_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.0" lineColor="#000000"/>
</box>
<conditionalStyle>
<conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression>
<style backcolor="#FFFFFF"/>
</conditionalStyle>
</style>
<subDataset name="Table LineItems" uuid="183918c2-b66e-4347-ae7b-e891ab0a1d88">
<field name="time" class="java.lang.String"/>
</subDataset>
<parameter name="timeList" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band splitType="Stretch"/>
</title>
<detail>
<band height="70">
<componentElement>
<reportElement key="table 1" style="table 1" positionType="Float" x="0" y="0" width="504" height="70" uuid="eb4057df-dd6a-40dd-870e-baac8c8afe17">
<property name="local_mesure_unitwidth" value="inch"/>
<property name="com.jaspersoft.studio.unit.width" value="inch"/>
<printWhenExpression><![CDATA[$V{REPORT_COUNT} == 1]]></printWhenExpression>
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="Table LineItems" uuid="8a44aec8-cdd4-4be3-b47a-620e00bb910a">
<datasetParameter name="REPORT_DATA_SOURCE">
<datasetParameterExpression><![CDATA[$P{timeList}]]></datasetParameterExpression>
</datasetParameter>
</datasetRun>
<jr:column width="70" uuid="baa7f786-d12a-4234-b9d7-faef6c9f25df">
<jr:detailCell style="table 1_TD" height="20" rowSpan="1">
<box>
<pen lineWidth="0.0"/>
<topPen lineWidth="0.0"/>
<leftPen lineWidth="0.0"/>
<bottomPen lineWidth="0.0"/>
<rightPen lineWidth="0.0"/>
</box>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement x="0" y="0" width="70" height="20" uuid="5f84b7ac-c2fe-4426-b91f-6714b470a2bc"/>
<box topPadding="5" leftPadding="2" bottomPadding="5" rightPadding="2">
<topPen lineWidth="0.5"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="8" isBold="false"/>
<paragraph rightIndent="4"/>
</textElement>
<textFieldExpression><![CDATA[$F{time}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</detail>
<columnFooter>
<band splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band splitType="Stretch"/>
</pageFooter>
<summary>
<band splitType="Stretch"/>
</summary>
</jasperReport>
The output looks like this
P.S. I didn't really pay attention to styling here. Hope this helps someone although I am 7 years late.