jaspersoft report bar graph - jasper-reports

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>

Related

How to combine repited values in one border in Jasper Report?

I created Jasper report which doesn't print repited values in the first column "Route" (field name groupDescription)
It works ok, but the problem is - it doesn't combine borders of those repited values.
I tried add first column to separate group and change the borders, but it didn't help.
How can I combine borders as well, so in result report can look like this?
Here is my jrxml file
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.19.1.final using JasperReports Library version 6.19.1-867c00bf88cd4d784d404379d6c05e1b419e8a4c -->
<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="gpsmisseddataonroute" pageWidth="705" pageHeight="842" columnWidth="685" leftMargin="10" rightMargin="10" topMargin="10" bottomMargin="10" isFloatColumnFooter="true" isIgnorePagination="true" uuid="3ebc481d-07fa-407e-8647-51d27f87c7f2">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="net.sf.jasperreports.export.csv.field.delimiter" value=";"/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<style name="Default" isDefault="true" pdfFontName="/fonts/ARIALN.TTF" pdfEncoding="Identity-H"/>
<parameter name="carrier" class="java.lang.String"/>
<parameter name="date" class="java.lang.String"/>
<parameter name="time" class="java.lang.String"/>
<parameter name="header" class="java.lang.String"/>
<parameter name="groupDescription" class="java.lang.String"/>
<parameter name="ordinal" class="java.lang.String"/>
<parameter name="licensePlate" class="java.lang.String"/>
<parameter name="lastEventTime" class="java.lang.String"/>
<parameter name="notes" class="java.lang.String"/>
<field name="groupDescription" class="java.lang.String"/>
<field name="ordinal" class="java.lang.String"/>
<field name="licensePlate" class="java.lang.String"/>
<field name="lastEventTime" class="java.lang.String"/>
<field name="notes" class="java.lang.String"/>
<title>
<band height="90">
<textField>
<reportElement x="65" y="20" width="284" height="20" uuid="1587c4cd-9174-4d1f-aa3e-665507834e77"/>
<textElement verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{carrier}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="65" y="40" width="284" height="20" uuid="1bb50a29-26f6-4389-b448-de69a4167c80"/>
<textElement verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{date}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="65" y="60" width="284" height="20" uuid="94b925f3-e71a-4094-a5f3-ac8d61fa2a62"/>
<textElement verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{time}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="0" width="685" height="20" uuid="49caef1a-d5a7-4174-a84f-1fb62d89d4c1"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="14"/>
</textElement>
<textFieldExpression><![CDATA[$P{header}]]></textFieldExpression>
</textField>
</band>
</title>
<columnHeader>
<band height="40" splitType="Stretch">
<staticText>
<reportElement mode="Opaque" x="245" y="0" width="29" height="35" backcolor="#999999" uuid="3ee4cb1f-ec9b-448f-b734-2427fd2764f8"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="2.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[#]]></text>
</staticText>
<textField>
<reportElement stretchType="RelativeToTallestObject" mode="Opaque" x="274" y="0" width="46" height="35" backcolor="#999999" uuid="b7816a55-171c-40ea-bbea-fa6685309ba8"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="2.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{ordinal}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="RelativeToTallestObject" mode="Opaque" x="320" y="0" width="130" height="35" backcolor="#999999" uuid="a6a976e9-6466-45b0-8f35-b32545efd711"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="2.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="11" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{licensePlate}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="RelativeToTallestObject" mode="Opaque" x="450" y="0" width="112" height="35" backcolor="#999999" uuid="2190c925-a2e1-48f3-983b-9a4f7911de64"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="2.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{lastEventTime}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="RelativeToTallestObject" mode="Opaque" x="562" y="0" width="123" height="35" backcolor="#999999" uuid="b4b3fe7d-8b2a-4d41-9544-d8f0beb5ae63"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="2.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{notes}]]></textFieldExpression>
</textField>
<textField>
<reportElement stretchType="RelativeToTallestObject" mode="Opaque" x="0" y="0" width="245" height="35" backcolor="#999999" uuid="ada908a0-7ade-40e6-8c70-3d842fb45e05"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="2.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{groupDescription}]]></textFieldExpression>
</textField>
</band>
</columnHeader>
<detail>
<band height="29" splitType="Stretch">
<textField isStretchWithOverflow="true">
<reportElement stretchType="RelativeToTallestObject" x="245" y="0" width="29" height="24" uuid="a14ad59f-e9d5-4a26-8dae-efcb9e95484d"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12" pdfEncoding="Identity-H"/>
<paragraph leftIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$V{COLUMN_COUNT}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement stretchType="RelativeToTallestObject" x="274" y="0" width="46" height="24" uuid="ca3caa3a-ef01-4ecd-8582-f499261ec6e0"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12"/>
<paragraph rightIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$F{ordinal}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement stretchType="RelativeToTallestObject" x="320" y="0" width="130" height="24" uuid="6c0e24a2-f97c-43d0-a055-2f4d19e34225"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12"/>
<paragraph rightIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$F{licensePlate}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement stretchType="RelativeToTallestObject" x="450" y="0" width="112" height="24" uuid="1e0d4140-5702-4deb-bfe0-ef2bf50d9d92"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<leftPen lineWidth="2.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{lastEventTime}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement stretchType="RelativeToTallestObject" x="562" y="0" width="123" height="24" uuid="2953ab4e-507b-4f07-8ded-ff480873d557"/>
<box>
<pen lineWidth="1.0"/>
<topPen lineWidth="1.0"/>
<bottomPen lineWidth="1.0"/>
<rightPen lineWidth="1.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{notes}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement stretchType="RelativeToTallestObject" isPrintRepeatedValues="false" x="0" y="0" width="245" height="24" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" uuid="58eb7f6a-1f5c-47fb-b24a-275d92968a1d"/>
<box>
<pen lineWidth="1.0"/>
<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>
<textElement verticalAlignment="Middle">
<font fontName="DejaVu Sans" size="12"/>
<paragraph leftIndent="5"/>
</textElement>
<textFieldExpression><![CDATA[$F{groupDescription}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>

In Jaspersoft studio 6, How to calculate total for a particular row in crosstab

I am using in Jaspersoft studio 6 and currently working with crosstab. I am a newbie in crosstab and have just started using it. I have created a jrxml file with crosstab(with lots of trial and error, I might add) as follows
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0 -->
<!-- 2022-06-29T20:43:31 -->
<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="MAH_Attendance_subjasper" pageWidth="1500" pageHeight="650" orientation="Landscape" columnWidth="1460" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="0e151e12-e64e-4195-aba5-d1747d8a798d">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="MAH HR DB"/>
<style name="Crosstab_CH" mode="Opaque"/>
<style name="Crosstab_CG" 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="Crosstab_CT" mode="Opaque" backcolor="#005FB3">
<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="Crosstab_CD" 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="CS_Sunday" backcolor="#FFFFFF">
<conditionalStyle>
<conditionExpression><![CDATA[$V{DayOfWeeek}=="SUN"]]></conditionExpression>
<style forecolor="#058FFF" backcolor="#737373"/>
</conditionalStyle>
</style>
<queryString language="SQL">
<![CDATA[SELECT
emp.emp_number AS empNumber,
CONCAT_WS(" ",emp.first_name,emp.middle_name,emp.last_name)AS emp_name,
att.punch_in_time AS PunchInTime,
att.punch_out_time AS PunchOutTime,
TIME_FORMAT(TIMEDIFF(CONCAT(DATE(att.punch_out_date)," ",(att.punch_out_time)),CONCAT(DATE(att.punch_in_date)," ",(att.punch_in_time))),'%H:%i') AS Total,
att.shift_in_time AS Rosterin,
att.shift_out_time AS Rosterout,
TIME_FORMAT(TIMEDIFF(att.punch_out_time,att.shift_out_time),'%H:%i') AS Extra,
IFNULL(DATE(att.punch_in_date),'') AS punch_in_date,
DAYOFMONTH(att.punch_in_date) AS DayOfMonthh,
CASE
WHEN DAYOFWEEK(att.punch_in_date)=1 THEN 'SUN'
WHEN DAYOFWEEK(att.punch_in_date)=2 THEN 'MON'
WHEN DAYOFWEEK(att.punch_in_date)=3 THEN 'TUE'
WHEN DAYOFWEEK(att.punch_in_date)=4 THEN 'WED'
WHEN DAYOFWEEK(att.punch_in_date)=5 THEN 'THU'
WHEN DAYOFWEEK(att.punch_in_date)=6 THEN 'FRI'
WHEN DAYOFWEEK(att.punch_in_date)=7 THEN 'SAT'
END AS DayOfWeeek
FROM
hr_employees emp,
hr_pay_periods hpr,
hr_setup SETUP1,
hr_setup SETUP2,
hr_transfers tr,
hr_emp_attendance att
LEFT JOIN hr_leaves lv ON (att.employee_id=lv.employee_id AND att.punch_in_date BETWEEN lv.start_date AND lv.end_date)
LEFT JOIN hr_leave_types lt ON(lt.id = lv.leave_type_id AND lt.leave_division_code='LOP')
WHERE
emp.id =att.employee_id
AND emp.id =tr.employee_id
AND emp.emp_number=1
AND tr.active_yn='1'
AND DATE_FORMAT(tr.start_date,'%Y-%m-%d')<=DATE_FORMAT(hpr.end_date,'%Y-%m-%d')
AND (DATE_FORMAT(tr.end_date,'%Y-%m-%d')>=DATE_FORMAT(hpr.start_date,'%Y-%m-%d') OR tr.end_date IS NULL)
AND DATE_FORMAT(att.punch_in_date,'%Y-%m-%d') >=DATE_FORMAT(hpr.start_date,'%Y-%m-%d')
AND DATE_FORMAT(att.punch_in_date,'%Y-%m-%d') <=DATE_FORMAT(hpr.end_date,'%Y-%m-%d')
AND DATE_FORMAT(att.punch_in_date,'%Y-%m-%d') >=DATE_FORMAT(tr.start_date,'%Y-%m-%d')
AND (DATE_FORMAT(att.punch_in_date,'%Y-%m-%d')<=DATE_FORMAT(tr.end_date,'%Y-%m-%d') OR tr.end_date IS NULL)
AND SETUP1.setup_key="HR_EMPLOYEE_NUM_PREFIX"
AND SETUP2.setup_key="HR_EMPLOYEE_NUM_SUFFIX"
AND att.punch_in_date BETWEEN '2022-03-01' AND '2022-03-31'
ORDER BY emp.emp_number,punch_in_date]]>
</queryString>
<field name="empNumber" class="java.lang.String"/>
<field name="emp_name" class="java.lang.String"/>
<field name="PunchInTime" class="java.sql.Time"/>
<field name="PunchOutTime" class="java.sql.Time"/>
<field name="Total" class="java.sql.Time"/>
<field name="Rosterin" class="java.sql.Time"/>
<field name="Rosterout" class="java.sql.Time"/>
<field name="Extra" class="java.sql.Time"/>
<field name="punch_in_date" class="java.lang.Object"/>
<field name="DayOfMonthh" class="java.lang.Integer"/>
<field name="DayOfWeeek" class="java.lang.String"/>
<variable name="Variable_1" class="java.lang.String"/>
<variable name="Variable_2" class="java.lang.String"/>
<variable name="Variable_3" class="java.lang.String"/>
<variable name="Variable_4" class="java.lang.String"/>
<variable name="Variable_5" class="java.lang.String"/>
<variable name="Variable_6" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<summary>
<band height="161" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<crosstab ignoreWidth="false">
<reportElement x="0" y="0" width="1420" height="160" uuid="b9ff42cf-4d41-4581-93ba-9a6a0d737d58">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
<property name="com.jaspersoft.studio.crosstab.style.header" value="Crosstab_CH"/>
<property name="com.jaspersoft.studio.crosstab.style.group" value="Crosstab_CG"/>
<property name="com.jaspersoft.studio.crosstab.style.total" value="Crosstab_CT"/>
<property name="com.jaspersoft.studio.crosstab.style.detail" value="Crosstab_CD"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
</box>
<crosstabHeaderCell>
<cellContents>
<textField pattern="" isBlankWhenNull="false">
<reportElement key="textField-1" mode="Transparent" x="0" y="0" width="60" height="20" forecolor="#000000" backcolor="#FFFFFF" uuid="5cb94b6f-b1c1-4751-8cc9-1023a08817ba"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
<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="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None">
<font fontName="Arial" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA["Date"]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement key="textField-1" style="CS_Sunday" mode="Transparent" x="0" y="20" width="60" height="20" forecolor="#000000" backcolor="#FFFFFF" uuid="acfafcf8-f527-474d-8627-a7132a747c48"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
<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="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None">
<font fontName="Arial" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA["Day"]]></textFieldExpression>
</textField>
</cellContents>
</crosstabHeaderCell>
<rowGroup name="empNumber" width="60" mergeHeaderCells="false">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{empNumber}]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents mode="Opaque" style="Crosstab_CH">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
<textField pattern="" isBlankWhenNull="false">
<reportElement key="textField-1" mode="Transparent" x="0" y="0" width="60" height="20" forecolor="#000000" backcolor="#FFFFFF" uuid="46855b10-d1a0-4975-b4a9-0c4e63fc8004"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
<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="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None">
<font fontName="Arial" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA["In"]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement key="textField-1" mode="Transparent" x="0" y="20" width="60" height="20" forecolor="#000000" backcolor="#FFFFFF" uuid="61085207-f106-4ae5-a7be-a40dd4f9e33b"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
<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="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None">
<font fontName="Arial" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA["Out"]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement key="textField-1" mode="Transparent" x="0" y="40" width="60" height="20" forecolor="#000000" backcolor="#FFFFFF" uuid="577e468c-f2a4-4e42-99f1-287363338475"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
<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="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None">
<font fontName="Arial" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA["Total"]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement key="textField-1" mode="Transparent" x="0" y="60" width="60" height="20" forecolor="#000000" backcolor="#FFFFFF" uuid="d89eaa0d-ddd9-4352-9fbb-46572e082ed5"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
<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="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None">
<font fontName="Arial" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA["Roster In"]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement key="textField-1" mode="Transparent" x="0" y="80" width="60" height="20" forecolor="#000000" backcolor="#FFFFFF" uuid="1e60e74b-1df1-4a2b-8ba4-e639b7c95a47"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
<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="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None">
<font fontName="Arial" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA["Roster Out"]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement key="textField-1" mode="Transparent" x="0" y="100" width="60" height="20" forecolor="#000000" backcolor="#FFFFFF" uuid="c9cb35b1-69d9-4075-8a74-2b6e3a5d4916">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
</reportElement>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
<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="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None">
<font fontName="Arial" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA["Extra"]]></textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
<crosstabTotalRowHeader>
<cellContents mode="Opaque" style="Crosstab_CT">
<staticText>
<reportElement x="0" y="0" width="0" height="0" forecolor="#FFFFFF" uuid="6b02ffab-4f0f-4c9b-ab2c-46ca85f651a3"/>
<text><![CDATA[Total empNumber]]></text>
</staticText>
</cellContents>
</crosstabTotalRowHeader>
</rowGroup>
<columnGroup name="DayOfMonthh" height="20" totalPosition="End">
<bucket class="java.lang.Integer">
<bucketExpression><![CDATA[$F{DayOfMonthh}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents mode="Opaque" style="Crosstab_CH">
<textField>
<reportElement style="CS_Sunday" x="0" y="0" width="40" height="20" uuid="718bc55d-1ed4-460e-80dd-af8703ba0c90">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{DayOfMonthh}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents mode="Opaque" style="Crosstab_CT">
<staticText>
<reportElement x="0" y="0" width="0" height="0" forecolor="#FFFFFF" uuid="07e7807e-6981-4dab-b854-c5c8bf274b97"/>
<text><![CDATA[Total DayOfMonthh]]></text>
</staticText>
</cellContents>
</crosstabTotalColumnHeader>
</columnGroup>
<columnGroup name="DayOfWeeek" height="20">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{DayOfWeeek}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents mode="Opaque" style="CS_Sunday">
<textField isBlankWhenNull="true">
<reportElement style="CS_Sunday" x="0" y="0" width="40" height="20" uuid="23a405f5-a6c2-4f4a-be59-d9d5a9e16f3f"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{DayOfWeeek}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents mode="Opaque" style="Crosstab_CG">
<staticText>
<reportElement x="0" y="0" width="40" height="20" uuid="edcbd158-c0e7-4268-aff9-0e302e553b25"/>
<text><![CDATA[Total DayOfWeeek]]></text>
</staticText>
</cellContents>
</crosstabTotalColumnHeader>
</columnGroup>
<measure name="PunchInTime_MEASURE" class="java.sql.Time" calculation="Count">
<measureExpression><![CDATA[$F{PunchInTime}]]></measureExpression>
</measure>
<measure name="PunchOutTime_MEASURE" class="java.sql.Time" calculation="Count">
<measureExpression><![CDATA[$F{PunchOutTime}]]></measureExpression>
</measure>
<measure name="Total_MEASURE" class="java.sql.Time">
<measureExpression><![CDATA[$F{Total}]]></measureExpression>
</measure>
<measure name="Rosterin_MEASURE" class="java.sql.Time" calculation="Count">
<measureExpression><![CDATA[$F{Rosterin}]]></measureExpression>
</measure>
<measure name="Rosterout_MEASURE" class="java.sql.Time" calculation="Count">
<measureExpression><![CDATA[$F{Rosterout}]]></measureExpression>
</measure>
<measure name="Extra_MEASURE" class="java.sql.Time" calculation="Count">
<measureExpression><![CDATA[$F{Extra}]]></measureExpression>
</measure>
<measure name="Measure1" class="java.sql.Time" calculation="Sum">
<measureExpression><![CDATA[$F{Extra}]]></measureExpression>
</measure>
<crosstabCell width="40" height="120">
<cellContents mode="Opaque" style="Crosstab_CD">
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<textField pattern="HH:mm" isBlankWhenNull="true">
<reportElement style="CS_Sunday" x="0" y="0" width="40" height="20" uuid="4b55089e-2a5c-4ce4-beea-3bb57815c61b"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{PunchInTime_MEASURE}]]></textFieldExpression>
</textField>
<textField pattern="HH:mm" isBlankWhenNull="true">
<reportElement style="CS_Sunday" x="0" y="20" width="40" height="20" uuid="bd55a1cc-0094-482b-b3ff-35197f893d52"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{PunchOutTime_MEASURE}]]></textFieldExpression>
</textField>
<textField pattern="HH:mm" isBlankWhenNull="true">
<reportElement style="CS_Sunday" x="0" y="40" width="40" height="20" uuid="6a7f1df0-e5df-42f1-8ca7-df0d2baa4ee5"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{Total_MEASURE}]]></textFieldExpression>
</textField>
<textField pattern="HH:mm" isBlankWhenNull="true">
<reportElement style="CS_Sunday" x="0" y="60" width="40" height="20" uuid="84b3700f-d3e9-4401-be4e-db1b6c6ea42e"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{Rosterin_MEASURE}]]></textFieldExpression>
</textField>
<textField pattern="HH:mm" isBlankWhenNull="true">
<reportElement style="CS_Sunday" x="0" y="80" width="40" height="20" uuid="d118ce37-b5d5-4082-8244-31941463812b"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{Rosterout_MEASURE}]]></textFieldExpression>
</textField>
<textField pattern="HH:mm" isBlankWhenNull="true">
<reportElement style="CS_Sunday" x="0" y="100" width="40" height="20" uuid="f79896f4-39d6-4de6-8c6f-1ec067bd503e"/>
<box>
<pen lineWidth="1.0" lineStyle="Solid"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$V{Extra_MEASURE}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell height="120" columnTotalGroup="DayOfMonthh">
<cellContents>
<textField pattern="HH:mm">
<reportElement x="0" y="0" width="40" height="120" uuid="3b6da2ce-2fe5-40b4-bbfb-2fed9b9d3217"/>
<textFieldExpression><![CDATA[$V{Measure1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="60" height="20" rowTotalGroup="empNumber" columnTotalGroup="DayOfMonthh">
<cellContents/>
</crosstabCell>
<crosstabCell height="120" columnTotalGroup="DayOfWeeek">
<cellContents/>
</crosstabCell>
<crosstabCell width="60" height="20" rowTotalGroup="empNumber" columnTotalGroup="DayOfWeeek">
<cellContents/>
</crosstabCell>
</crosstab>
</band>
</summary>
</jasperReport>
Following is the output
https://ibb.co/x75CB7Y
I have 2 requirements:
I would like to show the sum for two rows - Total and Extra.
For the Sunday columns cells, I would like to have gray color as the background.
For the second item, I know that we can use conditional style. I have tried using it but I could not get it to work. I would appriciate any help.
Edit:
I have managed to add a new measure for the sum. But as the field is of the type java.sql.Time, I am unable to get the sum of all rows. It just gives the last value of the row in the sum measure field. I have updated the jrxml file and the output above. Is there any workaround for getting the sum of time values?

How can I get the first record of the table by using the same data-source for the main report and table in Jasper reports?

According to my design requirement, I am trying to create a simple Jasper report( using Jasper-soft Studio in 6.12 version) with Table in which the main report and table should be populated by java code using JRResultSetDataSource object with same query execution or data-source and also calculating the record count in page header, of the number of rows fetched in the table from the database.
But the problem is that- Either only table is getting  populated through the data Source or only main report is getting populated or while providing same data-source to both main report and table then the first record of the table is missing because the record pointer in the data source is incremented as the data-source is passed from main report to table. Nor am I able to clone the data source to provide a copy of the data-source to the table as it is not supported for JRResultSetDataSource.
I want to use the same data-source to populate the table and to populate text fields present in the main report.
Java code-
Connection con;
 Statement stmt;
 ResultSet rs;
 try {
      Class.forName("org.postgresql.Driver");
      con=DriverManager.getConnection("jdbc:postgresql://localhost:5432/jasperexamples", "postgres", "password");
       stmt=con.createStatement();
       String query= "select * from product";
       rs=stmt.executeQuery(query);
            
       JRResultSetDataSource rsdt = new JRResultSetDataSource(rs);
       String jasperReport = "/home/sakshi/JaspersoftWorkspace/MyReports/JasperProduct.jasper";
       JasperPrint jp1 = JasperFillManager.fillReport(jasperReport, new HashMap<String, Object>(),rsdt);
        JasperViewer jv = new JasperViewer(jp1);
        jv.setVisible(true);
        con.close();
  }
  catch(Exception e) {
        e.printStackTrace();
  }
Jrxml code-
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.12.2.final using JasperReports Library version 6.12.2-75c5e90a222ab406e416cbf590a5397028a52de3 -->
<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="JasperProduct" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="0d6d7195-8cff-4512-be5d-258e505e6836">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<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">
<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>
<subDataset name="Dataset1" uuid="0dc50125-a9d2-458b-82aa-27bfa253f3e9">
<queryString>
<![CDATA[]]>
</queryString>
<field name="id" class="java.lang.Integer"/>
<field name="prouductname" class="java.lang.String"/>
<field name="productprize" class="java.lang.String"/>
<field name="company" class="java.lang.String"/>
</subDataset>
<queryString>
<![CDATA[]]>
</queryString>
<field name="id" class="java.lang.Integer"/>
<field name="prouductname" class="java.lang.String"/>
<field name="productprize" class="java.lang.String"/>
<field name="company" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.FreeLayout"/>
<staticText>
<reportElement x="0" y="20" width="802" height="30" uuid="463c4bc3-254d-4c78-a35e-0096dc006165"/>
<box leftPadding="5"/>
<textElement verticalAlignment="Middle">
<font size="24"/>
</textElement>
<text><![CDATA[Product Report]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="55" splitType="Stretch">
<staticText>
<reportElement x="5" y="17" width="110" height="30" uuid="836aa66c-e052-4ca1-ac75-feb821efa866"/>
<textElement verticalAlignment="Middle">
<font size="14"/>
</textElement>
<text><![CDATA[Report Count]]></text>
</staticText>
<textField textAdjust="StretchHeight">
<reportElement x="125" y="17" width="100" height="30" uuid="500a4853-c045-4897-a007-6e77598a31c7"/>
<textElement verticalAlignment="Middle">
<font size="14"/>
</textElement>
<textFieldExpression><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<detail>
<band height="199" splitType="Stretch">
<componentElement>
<reportElement x="0" y="34" width="802" height="126" uuid="dc722ea3-7c31-439b-996c-bb3892426aea">
<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="com.jaspersoft.studio.components.autoresize.proportional" value="true"/>
</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="Dataset1" uuid="2c3773b9-e3a5-4046-a9d7-825487945fbb">
<datasetParameter name="REPORT_DATA_SOURCE">
<datasetParameterExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></datasetParameterExpression>
</datasetParameter>
</datasetRun>
<jr:columnGroup width="802" uuid="35fb663c-fc50-45f9-8715-575fe5aa27f4">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Columns [4]"/>
<jr:tableHeader style="Table_TH" height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="802" height="30" uuid="9cdc6108-4308-449a-9995-182837f26b4d"/>
<box leftPadding="3"/>
<textElement verticalAlignment="Middle">
<font size="18"/>
</textElement>
<text><![CDATA[Product Details]]></text>
</staticText>
</jr:tableHeader>
<jr:columnGroup width="802" uuid="2282f969-105d-4cf7-9714-ce0eef6e7a2a">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Columns [4]"/>
<jr:tableFooter style="Table_TH" height="30" rowSpan="1">
<textField textAdjust="StretchHeight">
<reportElement mode="Opaque" x="0" y="0" width="802" height="30" uuid="4aa3d9f1-22dd-44bb-b002-b1fc83349c66"/>
<textElement verticalAlignment="Middle">
<font size="13"/>
</textElement>
<textFieldExpression><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression>
</textField>
</jr:tableFooter>
<jr:column width="200" uuid="88208a30-4a0d-4a22-8558-c9347efcab95">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="200" height="30" uuid="c7b0da69-05cb-4e00-b215-501476c06697"/>
<box leftPadding="3"/>
<textElement verticalAlignment="Middle">
<font size="12" isBold="true" isItalic="false"/>
</textElement>
<text><![CDATA[Id]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField textAdjust="StretchHeight">
<reportElement x="0" y="0" width="200" height="30" uuid="69c964ef-8985-4b28-adf2-eb89663ffa3c"/>
<box leftPadding="3"/>
<textElement verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{id}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="190" uuid="26ed996c-7261-48e1-bfdd-5492a313bee9">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="190" height="30" uuid="294980bc-20b3-472e-999f-5be40daacf01"/>
<box leftPadding="3"/>
<textElement verticalAlignment="Middle">
<font size="12" isBold="true" isItalic="false"/>
</textElement>
<text><![CDATA[Product Name]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField textAdjust="StretchHeight">
<reportElement x="0" y="0" width="190" height="30" uuid="30e24e73-2357-40a9-ba78-a8dff9938ab9"/>
<box leftPadding="3"/>
<textElement verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{prouductname}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="220" uuid="efd0925b-65d3-438e-950c-95fefc05998e">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column3"/>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="220" height="30" uuid="1480c534-2f5f-4cc7-96be-e275415b8cd0"/>
<box leftPadding="3"/>
<textElement verticalAlignment="Middle">
<font size="12" isBold="true" isItalic="false"/>
</textElement>
<text><![CDATA[Product Prize]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField textAdjust="StretchHeight">
<reportElement x="0" y="0" width="220" height="30" uuid="2df7f400-4845-4ebe-a874-c3ae91ccba2e"/>
<box leftPadding="3"/>
<textElement verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{productprize}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="192" uuid="dfd8aead-b732-4300-8a47-29b0a6b7605b">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column4"/>
<jr:columnHeader style="Table_CH" height="30">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="192" height="30" uuid="7fac6d69-f0eb-4ff2-82de-152872d9930d"/>
<box leftPadding="3"/>
<textElement verticalAlignment="Middle">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Company]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="30">
<textField textAdjust="StretchHeight">
<reportElement x="0" y="0" width="192" height="30" uuid="701bebcf-d200-4cf8-bd88-37f4578be852"/>
<box leftPadding="3"/>
<textElement verticalAlignment="Middle">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[$F{company}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:columnGroup>
</jr:columnGroup>
</jr:table>
</componentElement>
</band>
</detail>
<pageFooter>
<band height="62">
<staticText>
<reportElement x="0" y="20" width="160" height="30" uuid="dca10f20-8fa6-4e1b-8d48-16b549783ac6"/>
<box leftPadding="3">
<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>
<textElement verticalAlignment="Middle">
<font size="13" isBold="true"/>
</textElement>
<text><![CDATA[Company Name: ]]></text>
</staticText>
<textField textAdjust="StretchHeight">
<reportElement x="160" y="20" width="642" height="30" uuid="2e69e42c-7588-429b-a0dc-42042e24bd61"/>
<box leftPadding="3">
<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>
<textElement verticalAlignment="Middle">
<font size="13"/>
</textElement>
<textFieldExpression><![CDATA[$F{company}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
</jasperReport>
I have seen different approaches-
add a first empty row to the datasource before passing it to the
report.
passing two data sources- one to table and one to main
report.(But both work on the same datasource so it reduces the
performance).
But I don't think these approaches are good.
And also referred to different references but they didn't work according to my design requirement-
Why is my subdataset blank when I run report from Java code?
http://zetcode.com/articles/jaspertable/
http://junaedhalim.blogspot.com/2009/12/creating-jasperreport-with-subreports.html
https://community.jaspersoft.com/questions/540719/resolved-table-report-missing-1st-tablemodel-row
https://community.jaspersoft.com/questions/817326/table-not-displaying-any-values
Jasper Reports how to set data from JRResultSetDataSource into Table component
Can anyone please suggest a better approach for resolving this issue.
Thanks in advance

How to create a jasper table and textfields inside the list component with XML datasource?

I am trying to generate report using Jasper iReport Designer 5.6.0, where there is a list with table and some textfields. The generated report should look like this:
To do this, I'm using the following XML file as datasource:
<report>
<subreport>
<nameOfState>USA</nameOfState>
<persons>
<person>
<dateOfBirth>1989-02-01T00:00:00.000Z</dateOfBirth>
<fullName>Skyler White</fullName>
<address>Albuquerque 87107</address>
</person>
<person>
<dateOfBirth>1962-02-01T00:00:00.000Z</dateOfBirth>
<fullName>Jesse Pinkman</fullName>
<address>Santa Fé 28</address>
<companies>
<company>
<nameOfCompany>Company 124</nameOfCompany>
<addressOfCompany>Santa Fé 158</addressOfCompany>
</company>
</companies>
</person>
</persons>
</subreport>
<subreport>
<nameOfState>Germany</nameOfState>
<person>
<dateOfBirth>1970-02-01T00:00:00.000Z</dateOfBirth>
<fullName>Hank Schrader</fullName>
<address>El Paso 17</address>
<companies>
<company>
<nameOfCompany>El Paso Company</nameOfCompany>
<addressOfCompany>El Paso 28</addressOfCompany>
</company>
<company>
<nameOfCompany>COMPANY EPC</nameOfCompany>
<addressOfCompany>Santa Fé 18</addressOfCompany>
</company>
</companies>
</person>
</persons>
</subreport>
</report>
And jrxml template:
<?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="report1_subreport1" pageWidth="756" pageHeight="140" whenNoDataType="BlankPage" columnWidth="756" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" whenResourceMissingType="Error" isIgnorePagination="true" uuid="0a5fd60a-c7ea-46b7-a1e6-484cdedee54a">
<property name="ireport.zoom" value="1.7715610000000022"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<style name="table 3">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table 3_TH" mode="Opaque">
<box>
<pen lineWidth="0.0" lineColor="#000000"/>
</box>
</style>
<style name="table 3_CH" mode="Opaque" backcolor="#FFD0BF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 3_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="PersonsDataset" uuid="cf4c2515-8d53-4c2a-a6ca-d33257aa8e74">
<queryString language="xPath">
<![CDATA[/subreport/persons/person]]>
</queryString>
<field name="dateOfBirth" class="java.lang.String">
<fieldDescription><![CDATA[dateOfBirth]]></fieldDescription>
</field>
<field name="fullName" class="java.lang.String">
<fieldDescription><![CDATA[fullName]]></fieldDescription>
</field>
<field name="address" class="java.lang.String">
<fieldDescription><![CDATA[address]]></fieldDescription>
</field>
</subDataset>
<subDataset name="CompanyDataset" uuid="80440d3f-8de3-4fe7-8d02-62734435d23d">
<queryString language="xPath">
<![CDATA[/company]]>
</queryString>
<field name="nameOfCompany" class="java.lang.String">
<fieldDescription><![CDATA[child::text()]]></fieldDescription>
</field>
<field name="addressOfCompany" class="java.lang.String">
<fieldDescription><![CDATA[child::text()]]></fieldDescription>
</field>
</subDataset>
<queryString language="xPath">
<![CDATA[/subreport/persons/person]]>
</queryString>
<field name="nameOfState" class="java.lang.String">
<fieldDescription><![CDATA[nameOfState]]></fieldDescription>
</field>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="140" splitType="Stretch">
<componentElement>
<reportElement x="0" y="36" width="753" height="104" uuid="e417d0a1-9945-42e9-b12b-8bf0573c93ba"/>
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
<datasetRun subDataset="PersonsDataset" uuid="c0d23173-9df2-452c-9d97-78dee6f766ef">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/subreport/persons/person")]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="104" width="753">
<staticText>
<reportElement mode="Opaque" x="11" y="11" width="100" height="13" backcolor="#C0C0C0" uuid="21b820ed-d7eb-4c92-a1c7-8b60880bb3b6"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Full name]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="11" y="24" width="100" height="13" backcolor="#C0C0C0" uuid="1b637cc8-c654-4734-9ee8-debc404931a2"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Address:]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="11" y="37" width="100" height="13" backcolor="#C0C0C0" uuid="08dc2de1-652a-4cd5-b572-344dbadb3b91"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Date of birth:]]></text>
</staticText>
<textField>
<reportElement x="112" y="11" width="239" height="13" uuid="d18bd33c-028a-4cae-8748-e0f5b12faff5"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{fullName}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="112" y="24" width="239" height="13" uuid="242e9491-3e9b-450c-bbb8-bf7565e67fa6"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{address}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="112" y="37" width="239" height="13" uuid="efe7b9b3-7573-411a-bada-620939ada8dc"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{dateOfBirth}]]></textFieldExpression>
</textField>
<componentElement>
<reportElement key="NajdenaOsobaTable1" style="table 3" stretchType="RelativeToBandHeight" mode="Transparent" x="96" y="66" width="645" height="25" isPrintWhenDetailOverflows="true" uuid="99480409-009b-4f75-b435-ad99403ddb56"/>
<jr:table whenNoDataType="AllSectionsNoDetail">
<datasetRun subDataset="CompanyDataset" uuid="cc9ac018-67f1-4011-995c-d95cd30b8ce3">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/subreport/person/companies/company")]]></dataSourceExpression>
</datasetRun>
<jr:column width="125" uuid="db854a2c-d49e-46ae-a57b-38be7cd8e7f8">
<jr:tableHeader style="table 3_TH" height="17" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="125" height="17" backcolor="#C0C0C0" uuid="8ef76d08-af87-4e3b-9436-2f9863275e50"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" isBold="false" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Name of Company]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell style="table 3_TD" height="16" rowSpan="1">
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="125" height="16" isPrintWhenDetailOverflows="true" uuid="d1bcdf70-4494-4552-9c84-2c1acf29d5fa"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{nameOfCompany}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="160" uuid="db2c69c2-67ce-4de0-b8fc-4f24b969127f">
<jr:tableHeader style="table 3_TH" height="17" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="160" height="17" backcolor="#C0C0C0" uuid="80f738f8-58c1-4959-b441-b1a3424e6bd6"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Address of Company]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell style="table 3_TD" height="16" rowSpan="1">
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="160" height="16" isPrintWhenDetailOverflows="true" uuid="6351ecdf-eb49-4738-bb51-dee451c5761b"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{addressOfCompany}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</jr:listContents>
</jr:list>
</componentElement>
<textField>
<reportElement x="12" y="10" width="100" height="20" uuid="a8753122-9817-4500-81f2-99d703df00b8"/>
<textFieldExpression><![CDATA[$F{nameOfState}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
And this is what I'm getting as resulting report (grey line is a pagebreak):
This is image what the report inspector looks like in my iReport Designer
So I am only using the detail band in this subreport.
EDIT:
List is necesarry because the data are from multiple countries, and this jrxml represent subreport which is nested in the main report.
This is all about defining your subDataset (with related fields) and XPath query in subDataSource correctly. A general indication would be query down to node, then generate subDatasource stepping back one node.
The solution in this case is to first query for the detail band (main XPath query of report)
<queryString language="XPath">
<![CDATA[/report/subreport]]>
</queryString>
This way in detail band you access you first fields nameOfState.
Then
In detail band while we are "running" on node subreport we add the jr:list component the subDataSource will be /subreport/persons/person to access the fields dateOfBirth, fullName etc.
<datasetRun subDataset="PersonsDataset" uuid="c0d23173-9df2-452c-9d97-78dee6f766ef">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/subreport/persons/person")]]></dataSourceExpression>
</datasetRun>
and then we are at the node person so for the jr:table your query is /person/companies/company
<datasetRun subDataset="CompanyDataset" uuid="cc9ac018-67f1-4011-995c-d95cd30b8ce3">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/person/companies/company")]]></dataSourceExpression>
</datasetRun>
For subDataset and field definition see the full example, it's more straight forward, since you are creating the datasource (subDatasource) the XPath query is actually not need for the subDataset (it's only needed on main query), you only need to have correct field declaration with same names as xml tags.
Full jrxml
<?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="report1_subreport1" pageWidth="756" pageHeight="140" whenNoDataType="BlankPage" columnWidth="756" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" whenResourceMissingType="Error" isIgnorePagination="true" uuid="0a5fd60a-c7ea-46b7-a1e6-484cdedee54a">
<style name="table 3">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table 3_TH" mode="Opaque">
<box>
<pen lineWidth="0.0" lineColor="#000000"/>
</box>
</style>
<style name="table 3_CH" mode="Opaque" backcolor="#FFD0BF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 3_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<subDataset name="PersonsDataset" uuid="cf4c2515-8d53-4c2a-a6ca-d33257aa8e74">
<field name="dateOfBirth" class="java.lang.String">
<fieldDescription><![CDATA[dateOfBirth]]></fieldDescription>
</field>
<field name="fullName" class="java.lang.String">
<fieldDescription><![CDATA[fullName]]></fieldDescription>
</field>
<field name="address" class="java.lang.String">
<fieldDescription><![CDATA[address]]></fieldDescription>
</field>
</subDataset>
<subDataset name="CompanyDataset" uuid="80440d3f-8de3-4fe7-8d02-62734435d23d">
<field name="nameOfCompany" class="java.lang.String">
<fieldDescription><![CDATA[nameOfCompany]]></fieldDescription>
</field>
<field name="addressOfCompany" class="java.lang.String">
<fieldDescription><![CDATA[addressOfCompany]]></fieldDescription>
</field>
</subDataset>
<queryString language="xPath">
<![CDATA[/report/subreport]]>
</queryString>
<field name="nameOfState" class="java.lang.String">
<property name="net.sf.jasperreports.xpath.field.expression" value="nameOfState"/>
<fieldDescription><![CDATA[nameOfState]]></fieldDescription>
</field>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="140" splitType="Stretch">
<componentElement>
<reportElement x="0" y="36" width="753" height="104" uuid="e417d0a1-9945-42e9-b12b-8bf0573c93ba"/>
<jr:list xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" printOrder="Vertical">
<datasetRun subDataset="PersonsDataset" uuid="c0d23173-9df2-452c-9d97-78dee6f766ef">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/subreport/persons/person")]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="104" width="753">
<staticText>
<reportElement mode="Opaque" x="11" y="11" width="100" height="13" backcolor="#C0C0C0" uuid="21b820ed-d7eb-4c92-a1c7-8b60880bb3b6"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Full name]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="11" y="24" width="100" height="13" backcolor="#C0C0C0" uuid="1b637cc8-c654-4734-9ee8-debc404931a2"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Address:]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="11" y="37" width="100" height="13" backcolor="#C0C0C0" uuid="08dc2de1-652a-4cd5-b572-344dbadb3b91"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Date of birth:]]></text>
</staticText>
<textField>
<reportElement x="112" y="11" width="239" height="13" uuid="d18bd33c-028a-4cae-8748-e0f5b12faff5"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{fullName}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="112" y="24" width="239" height="13" uuid="242e9491-3e9b-450c-bbb8-bf7565e67fa6"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{address}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="112" y="37" width="239" height="13" uuid="efe7b9b3-7573-411a-bada-620939ada8dc"/>
<box leftPadding="2">
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement verticalAlignment="Middle">
<font size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{dateOfBirth}]]></textFieldExpression>
</textField>
<componentElement>
<reportElement key="NajdenaOsobaTable1" style="table 3" stretchType="RelativeToBandHeight" mode="Transparent" x="96" y="66" width="645" height="25" isPrintWhenDetailOverflows="true" uuid="99480409-009b-4f75-b435-ad99403ddb56"/>
<jr:table whenNoDataType="AllSectionsNoDetail">
<datasetRun subDataset="CompanyDataset" uuid="cc9ac018-67f1-4011-995c-d95cd30b8ce3">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("/person/companies/company")]]></dataSourceExpression>
</datasetRun>
<jr:column width="125" uuid="db854a2c-d49e-46ae-a57b-38be7cd8e7f8">
<jr:tableHeader style="table 3_TH" height="17" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="125" height="17" backcolor="#C0C0C0" uuid="8ef76d08-af87-4e3b-9436-2f9863275e50"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" isBold="false" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Name of Company]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell style="table 3_TD" height="16" rowSpan="1">
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="125" height="16" isPrintWhenDetailOverflows="true" uuid="d1bcdf70-4494-4552-9c84-2c1acf29d5fa"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{nameOfCompany}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="160" uuid="db2c69c2-67ce-4de0-b8fc-4f24b969127f">
<jr:tableHeader style="table 3_TH" height="17" rowSpan="1">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="160" height="17" backcolor="#C0C0C0" uuid="80f738f8-58c1-4959-b441-b1a3424e6bd6"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" pdfEncoding="Cp1250"/>
</textElement>
<text><![CDATA[Address of Company]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell style="table 3_TD" height="16" rowSpan="1">
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="160" height="16" isPrintWhenDetailOverflows="true" uuid="6351ecdf-eb49-4738-bb51-dee451c5761b"/>
<box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
<pen lineWidth="0.75"/>
<topPen lineWidth="0.75"/>
<leftPen lineWidth="0.75"/>
<bottomPen lineWidth="0.75"/>
<rightPen lineWidth="0.75"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="8" pdfEncoding="Cp1250"/>
</textElement>
<textFieldExpression><![CDATA[$F{addressOfCompany}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</jr:listContents>
</jr:list>
</componentElement>
<textField>
<reportElement x="12" y="10" width="100" height="20" uuid="a8753122-9817-4500-81f2-99d703df00b8"/>
<textFieldExpression><![CDATA[$F{nameOfState}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
Result

How to limit number of rows displayed in jasper report to just 5? [duplicate]

This question already has answers here:
Break the PDF document after 100 pages
(2 answers)
JasperReport size limit
(3 answers)
Closed 5 years ago.
I have to make a change to jasper report template
The fields 1 and 2 are rows of the data table of the jasper report. Grandtotal shows the total sum. Here, only top 5 rows of the results passed has to be shown but the grandtotal has to be sum of all the rows supplied. Currently. all the query results are passed into report. Thus it shows all the rows. How to change this template to show only top 5 rows and negate the rest. The grandtotal however should contain sum of all the rows. The template is below for reference. The template does not use group but just detail band.
<?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="vehicle_most_frequent " language="groovy" pageWidth="540" pageHeight="720" columnWidth="500" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="00746fd2-b3ac-404d-9dd1-101d4ba25774">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="columnNameMap" class="java.util.Map"/>
<parameter name="param" class="java.util.Map"/>
<field name="1" class="java.lang.String"/>
<field name="2" class="java.lang.Long"/>
<field name="3" class="java.lang.Long"/>
<variable name="2_sum" class="java.lang.Float" calculation="Sum">
<variableExpression><![CDATA[$F{2}]]></variableExpression>
</variable>
<variable name="2_percent" class="java.lang.Float" calculation="Sum">
<variableExpression><![CDATA[$F{2}]]></variableExpression>
</variable>
<title>
<band height="39" splitType="Stretch">
<textField pattern="" isBlankWhenNull="false">
<reportElement mode="Transparent" x="0" y="0" width="500" height="39" forecolor="#000000" backcolor="#FFFFFF" uuid="08c8dae3-4b33-4877-a71d-cd9669172164"/>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
<font fontName="SansSerif" size="13" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$P{param}.get("title")]]></textFieldExpression>
</textField>
</band>
</title>
<columnHeader>
<band height="28" splitType="Stretch">
<textField pattern="" isBlankWhenNull="false">
<reportElement mode="Opaque" x="0" y="0" width="229" height="28" forecolor="#000000" backcolor="#FF8705" uuid="ccbec519-7ab3-4f43-a39c-9542aa5591f6"/>
<box>
<pen lineWidth="1.25" lineStyle="Solid"/>
<topPen lineWidth="1.25" lineStyle="Solid"/>
<leftPen lineWidth="1.25" lineStyle="Solid"/>
<bottomPen lineWidth="1.25" lineStyle="Solid"/>
<rightPen lineWidth="1.25" lineStyle="Solid"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
<font fontName="SansSerif" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnNameMap}.get(1)]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement mode="Opaque" x="229" y="0" width="148" height="28" forecolor="#000000" backcolor="#FF8705" uuid="470b050f-1961-4549-bac3-ccb37880f14d"/>
<box>
<pen lineWidth="1.25"/>
<topPen lineWidth="1.25"/>
<leftPen lineWidth="1.25"/>
<bottomPen lineWidth="1.25"/>
<rightPen lineWidth="1.25"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
<font fontName="SansSerif" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnNameMap}.get(2)]]></textFieldExpression>
</textField>
<textField pattern="" isBlankWhenNull="false">
<reportElement mode="Opaque" x="377" y="0" width="123" height="28" forecolor="#000000" backcolor="#FF8705" uuid="bc9d1557-ad50-4301-8c63-8345d5661a08"/>
<box>
<pen lineWidth="1.25"/>
<topPen lineWidth="1.25"/>
<leftPen lineWidth="1.25"/>
<bottomPen lineWidth="1.25"/>
<rightPen lineWidth="1.25"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
<font fontName="SansSerif" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$P{columnNameMap}.get(3)]]></textFieldExpression>
</textField>
</band>
</columnHeader>
<detail>
<band height="20" splitType="Stretch">
<textField pattern="" isBlankWhenNull="false">
<reportElement mode="Transparent" x="0" y="0" width="229" height="20" forecolor="#000000" backcolor="#FFFFFF" uuid="d39709a4-ef29-4db6-a5a1-74d1dc5c3bdb"/>
<box>
<pen lineWidth="1.25" lineColor="#000000"/>
<topPen lineWidth="1.25" lineColor="#000000"/>
<leftPen lineWidth="1.25" lineColor="#000000"/>
<bottomPen lineWidth="1.25" lineColor="#000000"/>
<rightPen lineWidth="1.25" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
<font fontName="SansSerif" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$F{1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="229" y="0" width="148" height="20" uuid="0af88c77-922f-40f4-8acf-71921f715a14"/>
<box>
<pen lineWidth="1.25"/>
<topPen lineWidth="1.25"/>
<leftPen lineWidth="1.25"/>
<bottomPen lineWidth="1.25"/>
<rightPen lineWidth="1.25"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{2}]]></textFieldExpression>
</textField>
<textField evaluationTime="Auto" pattern="#,##0.00 %">
<reportElement x="377" y="0" width="123" height="20" uuid="3692483a-4fe9-44a8-87d7-965ff4f7e2c4"/>
<box>
<pen lineWidth="1.25"/>
<topPen lineWidth="1.25"/>
<leftPen lineWidth="1.25"/>
<bottomPen lineWidth="1.25"/>
<rightPen lineWidth="1.25"/>
</box>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[($F{2}?$F{2}/$V{2_sum}:0)]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="20" splitType="Stretch">
<staticText>
<reportElement mode="Opaque" x="0" y="0" width="229" height="20" forecolor="#000000" backcolor="#FFFF00" uuid="f72b8925-f6cd-4d5e-9617-63e971327211"/>
<box>
<pen lineWidth="1.25"/>
<topPen lineWidth="1.25"/>
<leftPen lineWidth="1.25"/>
<bottomPen lineWidth="1.25"/>
<rightPen lineWidth="1.25"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
<font fontName="SansSerif" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<text><![CDATA[Grandtotal]]></text>
</staticText>
<textField evaluationTime="Auto" pattern="" isBlankWhenNull="false">
<reportElement mode="Opaque" x="229" y="0" width="271" height="20" forecolor="#000000" backcolor="#FFFF00" uuid="a4e37752-e733-4ed5-823f-649eb0a2fa66"/>
<box>
<pen lineWidth="1.25"/>
<topPen lineWidth="1.25"/>
<leftPen lineWidth="1.25"/>
<bottomPen lineWidth="1.25"/>
<rightPen lineWidth="1.25"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
<font fontName="SansSerif" size="10" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1252" isPdfEmbedded="false"/>
<paragraph lineSpacing="Single"/>
</textElement>
<textFieldExpression><![CDATA[$V{2_sum}]]></textFieldExpression>
</textField>
</band>
</columnFooter>
</jasperReport>