Jasper Report Subreports is not showing data - jasper-reports

I have a jasper report with 2 subreports. When I execute the report from a Java program it shows up but with empty subreports. Here is my report:
<?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="report3" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="b0b596c0-43c5-4c85-8e81-e92b916f7bb5">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<style name="Title" fontName="Arial" fontSize="26" isBold="true" pdfFontName="Helvetica-Bold"/>
<style name="SubTitle" forecolor="#666666" fontName="Arial" fontSize="18"/>
<style name="Column header" forecolor="#666666" fontName="Arial" fontSize="12" isBold="true"/>
<style name="Detail" fontName="Arial" fontSize="12"/>
<parameter name="customer_id" class="java.lang.Integer">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["reports/"]]></defaultValueExpression>
</parameter>
<parameter name="order_date" class="java.util.Date">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="title" class="java.lang.String"/>
<queryString>
<![CDATA[SELECT
customer.`name` AS customer_name
FROM
`customer` customer
where id=$P{customer_id}]]>
</queryString>
<field name="customer_name" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="95" splitType="Stretch">
<staticText>
<reportElement style="SubTitle" x="102" y="65" width="54" height="20" uuid="57dccf10-55f0-4d62-b391-c0a835ea062b"/>
<textElement textAlignment="Right">
<font fontName="Serif" size="14"/>
</textElement>
<text><![CDATA[التاريخ:]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="478" y="65" width="77" height="20" uuid="cc412a3e-0e4f-4868-9ea3-75c9e2f08bd3"/>
<textElement textAlignment="Right">
<font fontName="Serif" size="14" isBold="true"/>
</textElement>
<text><![CDATA[المطلوب من:]]></text>
</staticText>
<textField>
<reportElement style="Detail" x="229" y="65" width="249" height="20" uuid="28bb50ef-8818-45d6-97c5-6608cc747060"/>
<textElement textAlignment="Right">
<font fontName="Serif" size="14"/>
</textElement>
<textFieldExpression><![CDATA[$F{customer_name}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="3" y="65" width="100" height="20" uuid="32a97ac4-8aab-4167-99d6-1c3489f83db2"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Serif" size="14"/>
</textElement>
<textFieldExpression><![CDATA[$P{order_date}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="Title" x="142" y="16" width="265" height="33" uuid="dc9fed5e-e03c-475c-bd2b-1b351c318192"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Serif" size="26" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{title}]]></textFieldExpression>
</textField>
</band>
</title>
<pageHeader>
<band splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band splitType="Stretch"/>
</columnHeader>
<detail>
<band height="195" splitType="Stretch">
<subreport>
<reportElement x="2" y="1" width="553" height="109" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="true" uuid="e9c0b556-6457-4dc8-9064-b9bf8a280490"/>
<subreportParameter name="title">
<subreportParameterExpression><![CDATA[$P{title}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="REPORT_CONNECTION">
<subreportParameterExpression><![CDATA[$P{REPORT_CONNECTION}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="order_date">
<subreportParameterExpression><![CDATA[$P{order_date}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="cust_id">
<subreportParameterExpression><![CDATA[$P{customer_id}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="customer_id">
<subreportParameterExpression><![CDATA[$P{customer_id}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[java.sql.DriverManager.getConnection("jdbc:mysql://localhost:3306/metal?useUnicode=yes&characterEncoding=UTF-8","root", "")]]></connectionExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "orders.jasper"]]></subreportExpression>
</subreport>
<subreport>
<reportElement positionType="Float" x="2" y="109" width="554" height="86" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="true" uuid="bca2d802-6eee-43c3-adb9-443cb2b11cd9"/>
<subreportParameter name="SUBREPORT_DIR">
<subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="title">
<subreportParameterExpression><![CDATA[$P{title}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="order_date">
<subreportParameterExpression><![CDATA[$P{order_date}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="cust_id">
<subreportParameterExpression><![CDATA[$P{customer_id}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="customer_id">
<subreportParameterExpression><![CDATA[$P{customer_id}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "order_additions.jasper"]]></subreportExpression>
</subreport>
</band>
</detail>
<columnFooter>
<band splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="30" splitType="Stretch">
<textField>
<reportElement style="Column header" x="435" y="9" width="80" height="20" uuid="aba41e81-e785-4bdf-bbaa-1d8c3be8b391"/>
<textElement textAlignment="Right">
<font size="10" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement style="Column header" x="515" y="9" width="40" height="20" uuid="ef8ba53a-7da2-4fb1-a438-d1b0e2eb3a25"/>
<textElement>
<font size="10" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField pattern="EEEEE dd MMMMM yyyy">
<reportElement style="Column header" x="2" y="9" width="197" height="20" uuid="84337f90-d94a-4f7a-a376-18bf89cc1de9"/>
<textElement>
<font size="10" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band splitType="Stretch"/>
</summary>
</jasperReport>
I guess my subreport doesn't get the connection from the parent report. How to fix this?

The second subreport that you include is the correct way to pass the connection
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
So you need to check
$P{SUBREPORT_DIR} + "order_additions.jasper", points to an actually report
and that the query in order_additions.jasper produce result.

Related

Document is empty in Jasper Studio

i am using a oracle data adapter. when i put my query in sql developer it returns value. but in jasper it shows document is empty. is their any way to check if my data adapter is working properly or not?
i am new in jasper studio. if any setting need to change please mention. i am using oracle 11G express edition.
here is my jrxml file:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.11.0.final using JasperReports Library version 6.11.0-0c4056ccaa4d25a5a8c45672d2f764ea3498bebb -->
<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="Cherry_2" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="13acf49e-4913-4d1b-bccc-113817ad15d1">
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="KHALID"/>
<style name="Title" forecolor="#FFFFFF" fontName="Times New Roman" fontSize="50" isBold="false"/>
<style name="SubTitle" forecolor="#CCCCCC" fontName="Times New Roman" fontSize="18" isBold="false"/>
<style name="Column header" forecolor="#666666" fontName="Times New Roman" fontSize="14" isBold="true"/>
<style name="Detail" mode="Transparent" fontName="Times New Roman"/>
<style name="Row" mode="Transparent" fontName="Times New Roman" pdfFontName="Times-Roman">
<conditionalStyle>
<conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 0]]></conditionExpression>
<style mode="Opaque" backcolor="#F0EFEF"/>
</conditionalStyle>
</style>
<queryString language="SQL">
<![CDATA[select c.productname, sum(b.quantity)
from orders a, orderdetails b, products c
where a.orderid = b.orderid
and b.PRODUCT = c.id
group by c.productname]]>
</queryString>
<field name="PRODUCTNAME" class="java.lang.String">
<property name="com.jaspersoft.studio.field.label" value="PRODUCTNAME"/>
</field>
<field name="SUM(B.QUANTITY)" class="java.math.BigDecimal">
<property name="com.jaspersoft.studio.field.label" value="SUM(B.QUANTITY)"/>
</field>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="132" splitType="Stretch">
<image>
<reportElement x="456" y="0" width="99" height="132" uuid="97705585-a0b5-4ec7-86f3-ae10c220e6af"/>
<imageExpression><![CDATA["cherry.jpg"]]></imageExpression>
</image>
<frame>
<reportElement mode="Opaque" x="0" y="0" width="451" height="95" backcolor="#000000" uuid="6c6ca4e1-17cd-4913-93d6-5e670ea9ae8a"/>
<staticText>
<reportElement style="Title" x="0" y="0" width="370" height="66" uuid="a2a2cac8-5a7d-4487-8c54-dab235ce4e21"/>
<textElement>
<font isBold="false"/>
</textElement>
<text><![CDATA[Cherry Title]]></text>
</staticText>
<staticText>
<reportElement style="SubTitle" x="157" y="66" width="249" height="29" uuid="8978eac3-c578-41c9-837e-48d2b0184642"/>
<textElement>
<font size="22" isBold="false"/>
</textElement>
<text><![CDATA[Cherry SubTitle]]></text>
</staticText>
</frame>
<frame>
<reportElement mode="Opaque" x="0" y="100" width="451" height="32" forecolor="#000000" backcolor="#CC0000" uuid="e3c14156-5b51-4201-918b-97fdc012e5d4"/>
<textField pattern="EEEEE dd MMMMM yyyy">
<reportElement x="307" y="12" width="144" height="20" forecolor="#FFFFFF" uuid="5c3301e7-a737-4c59-8a2f-a6c79fd1adb8"/>
<textElement textAlignment="Right">
<font size="12"/>
</textElement>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
</frame>
</band>
</title>
<pageHeader>
<band splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="26" splitType="Stretch">
<staticText>
<reportElement style="Column header" x="0" y="7" width="277" height="18" forecolor="#000000" uuid="a6b37150-9bee-492a-b969-f034f64edf4c">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="e1446586-9fcf-432d-9dd5-955ccb125ee4"/>
</reportElement>
<textElement>
<font isBold="false"/>
</textElement>
<text><![CDATA[PRODUCTNAME]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="277" y="7" width="277" height="18" forecolor="#000000" uuid="6d1296a7-fb7c-46ca-9371-77d96da01824">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="dd4b0dcc-1ffd-4aa0-9af2-c6c23bcffe7d"/>
</reportElement>
<textElement>
<font isBold="false"/>
</textElement>
<text><![CDATA[SUM(B.QUANTITY)]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="18" splitType="Stretch">
<frame>
<reportElement style="Row" mode="Opaque" x="0" y="0" width="555" height="18" uuid="b50221b5-8254-440b-8c6f-1f0b138c9259"/>
<textField textAdjust="StretchHeight">
<reportElement style="Detail" positionType="Float" x="0" y="0" width="277" height="18" uuid="3c5fe24a-0a12-4767-98ee-528641a8400b">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="e1446586-9fcf-432d-9dd5-955ccb125ee4"/>
</reportElement>
<textElement>
<font size="14"/>
</textElement>
<textFieldExpression><![CDATA[$F{PRODUCTNAME}]]></textFieldExpression>
</textField>
<textField textAdjust="StretchHeight">
<reportElement style="Detail" positionType="Float" x="277" y="0" width="277" height="18" uuid="f11c3ade-0bb6-4270-820f-639e51664491">
<property name="com.jaspersoft.studio.spreadsheet.connectionID" value="dd4b0dcc-1ffd-4aa0-9af2-c6c23bcffe7d"/>
</reportElement>
<textElement>
<font size="14"/>
</textElement>
<textFieldExpression><![CDATA[$F{SUM(B.QUANTITY)}]]></textFieldExpression>
</textField>
</frame>
</band>
</detail>
<columnFooter>
<band height="7" splitType="Stretch">
<line>
<reportElement positionType="FixRelativeToBottom" x="0" y="3" width="555" height="1" uuid="1133a906-5b71-476e-9f3e-bc97c97058c1"/>
<graphicElement>
<pen lineWidth="0.5" lineColor="#999999"/>
</graphicElement>
</line>
</band>
</columnFooter>
<pageFooter>
<band height="25" splitType="Stretch">
<frame>
<reportElement mode="Opaque" x="0" y="1" width="555" height="24" forecolor="#D0B48E" backcolor="#000000" uuid="729c3539-f946-4d0e-a0a7-bda2815ea1b0"/>
<textField evaluationTime="Report">
<reportElement style="Column header" x="513" y="0" width="40" height="20" forecolor="#FFFFFF" uuid="4834e99c-7f6c-485a-b098-50e5187f2ab4"/>
<textElement verticalAlignment="Middle">
<font size="10" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="Column header" x="433" y="0" width="80" height="20" forecolor="#FFFFFF" uuid="9825b46e-76f1-469a-abb8-a1cc27aad685"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="10" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
</textField>
<textField pattern="EEEEE dd MMMMM yyyy">
<reportElement style="Column header" x="2" y="1" width="197" height="20" forecolor="#FFFFFF" uuid="137d38c7-1a83-4fc5-b156-9d5f1b1a0ddc"/>
<textElement verticalAlignment="Middle">
<font size="10" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
</frame>
</band>
</pageFooter>
<summary>
<band splitType="Stretch"/>
</summary>
</jasperReport>
This problem happened to me once and I solved it confirmed the changes and it was not bringing data, in oracle run:
commit;

Show subreport independent of master datasource (master report) in ireport

Well, i have a Master and a SubReport where in master report i have 2 detail bands. In first detail band i put the "main datasource" (from fillReport), and in detail band 2 i put the subreport (datasource from a param).
My master report is configured to display "All Sections, No Detail" but the problem is that when "main datasource" dont have records the subreport isn't showed. I need show subreport detail independent of content of "main datasource".
How can i do it?
This is my report XML:
<?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="rf002" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="575" leftMargin="10" rightMargin="10" topMargin="10" bottomMargin="10" uuid="4436a245-e7f4-426f-aabc-806179a89e8a">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="84"/>
<parameter name="pathSubreport" class="java.lang.String">
<defaultValueExpression><![CDATA["/home/ronaldo/workspace/sender/src/main/webapp/WEB-INF/report/"]]></defaultValueExpression>
</parameter>
<parameter name="titulo" class="java.lang.String"/>
<parameter name="endereco" class="java.lang.String"/>
<parameter name="cep" class="java.lang.String"/>
<parameter name="estado" class="java.lang.String"/>
<parameter name="cidade" class="java.lang.String"/>
<parameter name="razaoSocial" class="java.lang.String"/>
<parameter name="pathLogomarca" class="java.lang.String"/>
<parameter name="usuario" class="java.lang.String"/>
<parameter name="dataFechamento" class="java.util.Date"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["/home/ronaldo/workspace/odontonew/src/main/webapp/WEB-INF/report/"]]></defaultValueExpression>
</parameter>
<parameter name="totaltt" class="java.lang.Double"/>
<parameter name="dentista" class="br.com.odontonew.bean.Dentista"/>
<parameter name="historicosCaixaDentista" class="java.lang.Object"/>
<parameter name="historicosPagamentoOrcamento" class="java.lang.Object"/>
<parameter name="parcelasAVencerHoje" class="java.lang.Object"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="nomePaciente" class="java.lang.String">
<fieldDescription><![CDATA[orcamento.paciente.pessoaFisica.nome]]></fieldDescription>
</field>
<field name="dataHoraConsulta" class="java.sql.Timestamp">
<fieldDescription><![CDATA[dataHoraAgendada]]></fieldDescription>
</field>
<field name="idConsulta" class="java.lang.Integer">
<fieldDescription><![CDATA[id]]></fieldDescription>
</field>
<field name="nomeProcedimento" class="java.lang.String">
<fieldDescription><![CDATA[itens.itemTabelaProcedimento.procedimento.nome]]></fieldDescription>
</field>
<field name="isConcluido" class="java.lang.Boolean">
<fieldDescription><![CDATA[itens.concluido]]></fieldDescription>
</field>
<group name="consulta">
<groupExpression><![CDATA[$F{idConsulta}]]></groupExpression>
<groupHeader>
<band height="33">
<textField isBlankWhenNull="true">
<reportElement x="8" y="16" width="276" height="14" uuid="fd8d4206-2b32-4619-a340-95b4357b6a1a"/>
<textElement>
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{nomePaciente}]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy h.mm a" isBlankWhenNull="true">
<reportElement x="292" y="16" width="184" height="14" uuid="e7b1cb6b-c4c4-42ab-b028-69e720f43f1f"/>
<textElement>
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{dataHoraConsulta}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="9" y="5" width="149" height="12" uuid="bf06788d-c15a-4547-8a6e-df2ae3be70ea"/>
<textElement>
<font size="8"/>
</textElement>
<text><![CDATA[Paciente da Consulta]]></text>
</staticText>
<staticText>
<reportElement x="292" y="5" width="149" height="12" uuid="4d788cff-e015-4085-a320-8924a6a6b48c"/>
<textElement>
<font size="8"/>
</textElement>
<text><![CDATA[Data e Hora da Consulta]]></text>
</staticText>
</band>
</groupHeader>
</group>
<background>
<band/>
</background>
<title>
<band height="90" splitType="Stretch">
<subreport>
<reportElement stretchType="RelativeToBandHeight" x="0" y="0" width="575" height="90" uuid="0999674d-9841-41dd-97c2-226b2186b45e"/>
<subreportParameter name="pathLogomarca">
<subreportParameterExpression><![CDATA[$P{pathLogomarca}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="cidade">
<subreportParameterExpression><![CDATA[$P{cidade}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="titulo">
<subreportParameterExpression><![CDATA[$P{titulo}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="cep">
<subreportParameterExpression><![CDATA[$P{cep}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="estado">
<subreportParameterExpression><![CDATA[$P{estado}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="usuario">
<subreportParameterExpression><![CDATA[$P{usuario}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="razaoSocial">
<subreportParameterExpression><![CDATA[$P{razaoSocial}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="endereco">
<subreportParameterExpression><![CDATA[$P{endereco}]]></subreportParameterExpression>
</subreportParameter>
<subreportExpression><![CDATA[$P{pathSubreport}+"headerTemplate.jasper"]]></subreportExpression>
</subreport>
</band>
</title>
<columnHeader>
<band height="76">
<rectangle>
<reportElement x="0" y="27" width="575" height="49" backcolor="#DFDCDC" uuid="4e1f0879-74cc-46bf-8fb2-bb60ea002018"/>
<graphicElement>
<pen lineWidth="0.0"/>
</graphicElement>
</rectangle>
<staticText>
<reportElement x="416" y="57" width="140" height="14" uuid="afd4b28f-8b51-43d1-a9a2-c4acbb1f6c63"/>
<textElement textAlignment="Center">
<font isBold="true"/>
</textElement>
<text><![CDATA[Concluído]]></text>
</staticText>
<staticText>
<reportElement x="7" y="57" width="397" height="14" uuid="2c8deaa8-9d46-4c31-a542-e41b7f959615"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[Procedimento]]></text>
</staticText>
<staticText>
<reportElement x="9" y="34" width="397" height="14" uuid="6578bf15-8e39-4a0d-9fc6-5c45fb5ad566"/>
<textElement>
<font isBold="true" isItalic="true" isUnderline="false"/>
</textElement>
<text><![CDATA[Consultas Realizadas]]></text>
</staticText>
<textField pattern="dd/MM/yyyy" isBlankWhenNull="true">
<reportElement x="120" y="5" width="165" height="14" uuid="4a835664-78da-4231-b7de-a21b730b4a7e"/>
<textFieldExpression><![CDATA[$P{dataFechamento}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="6" y="5" width="112" height="14" uuid="8420da3e-43c6-49a6-a688-89d50b5095a7"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[Data Fechamento:]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="21">
<textField isBlankWhenNull="true">
<reportElement x="10" y="4" width="394" height="14" uuid="0f1109a2-30d7-4789-bb6f-54d066856cf3"/>
<textFieldExpression><![CDATA[$F{nomeProcedimento}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="425" y="1" width="131" height="14" uuid="6b67a6ee-6732-48b6-b79e-12f6e371c35e"/>
<textFieldExpression><![CDATA[$F{isConcluido} ? "Sim" : "Não"]]></textFieldExpression>
</textField>
</band>
<band height="173">
<subreport>
<reportElement x="0" y="0" width="575" height="73" uuid="871e12c8-2633-4d76-8d65-ce253710c4eb"/>
<dataSourceExpression><![CDATA[$P{historicosPagamentoOrcamento}]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "rf002_historicosPagamentoOrcamento.jasper"]]></subreportExpression>
</subreport>
<subreport>
<reportElement x="0" y="94" width="575" height="69" uuid="338fd0af-a2ca-453e-8777-0f49698ebb44"/>
<dataSourceExpression><![CDATA[$P{historicosCaixaDentista}]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "rf002_historicosCaixa.jasper"]]></subreportExpression>
</subreport>
</band>
</detail>
<lastPageFooter>
<band height="185" splitType="Stretch">
<textField evaluationTime="Report">
<reportElement x="516" y="155" width="40" height="20" uuid="3cd272a2-adde-48f0-9f1e-5d7f007b9a1f"/>
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="436" y="155" width="80" height="20" uuid="7cc86ec7-b620-4c95-9147-1410b1a22054"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
</textField>
</band>
</lastPageFooter>
</jasperReport>
SOLUTION
After a lot of research i saw that my concept about "main report" and "subreport" is wrong. When we have a "main report" (associated with a main datasource) the correct is that all "subreport" is directly associated with this. So, i created 3 subreports and pass all datasources like a 'param'. In JasperManagerFillReport i passed a "JREmptyDataSource" to avoid the blank page because "main datasource" don't have any content.
You can try setting WhenNoData property to NoDataSection. Then, in the No Data band add what you want.
Also, check what happens to the subreports when the parameters you send as dataSourceExpression are empty (if they are).

How to break the single Line chart into next pages

Can you please suggest the code for getting new pages.
How to break the single Line chart into next pages with JasperReports 5.0
Here the code i attached for more details.
<?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="SystemSummary" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="bd0eaa3b-093e-4699-83ef-75015530229d">
<parameter name="whereClause" class="java.lang.String"/>
<parameter name="bankLogo" class="java.lang.String"/>
<parameter name="bankName" class="java.lang.String"/>
<parameter name="fromDate" class="java.util.Date">
<parameterDescription><![CDATA[]]></parameterDescription>
</parameter>
<parameter name="toDate" class="java.util.Date"/>
<parameter name="noData" class="java.lang.String"/>
<parameter name="userId" class="java.lang.String"/>
<queryString>
<![CDATA[select avg(jbase_user) as jbaseAvg,AVG(t24_user) as t24Avg,to_char(load_time, 'dd.Mon.yy HH24') as period
from tmc_system_summary group by (to_char(load_time, 'dd.Mon.yy HH24'))]]>
</queryString>
<field name="jbaseavg" class="java.math.BigDecimal"/>
<field name="t24avg" class="java.math.BigDecimal"/>
<field name="period" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="2" splitType="Stretch"/>
</title>
<pageHeader>
<band height="57" splitType="Stretch">
<staticText>
<reportElement x="300" y="25" width="235" height="15" uuid="164831c1-9eff-4cf2-8706-331d28fdf431"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="12" isBold="true" pdfFontName="Helvetica-Bold"/>
</textElement>
<text><![CDATA[System Summary Report]]></text>
</staticText>
<textField pattern="dd/MM/yyyy">
<reportElement x="735" y="2" width="55" height="17" uuid="306ddad6-2b80-4abb-9893-859c59c8ede5"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="700" y="2" width="30" height="17" uuid="c6fdbff7-45a5-464e-bcbf-d550b174452f"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="Arial"/>
</textElement>
<text><![CDATA[Date:]]></text>
</staticText>
<image>
<reportElement x="20" y="3" width="130" height="30" uuid="513d2931-a2c7-4e54-bb86-188737502cae"/>
<imageExpression><![CDATA[$P{bankLogo}]]></imageExpression>
</image>
<staticText>
<reportElement x="20" y="40" width="58" height="14" uuid="5bd47ff1-6b81-428a-b7fd-50e777f70a22"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[From Date:]]></text>
</staticText>
<staticText>
<reportElement x="160" y="40" width="58" height="14" uuid="a7605d9e-c0d1-4a31-8230-c73db35766d4"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[To Date:]]></text>
</staticText>
<textField pattern="dd/MM/yyyy">
<reportElement x="80" y="40" width="70" height="14" uuid="faa13401-da98-4f06-ab43-5a1722d073f7"/>
<textFieldExpression><![CDATA[$P{fromDate} != null ? $P{fromDate} :" "]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy">
<reportElement x="215" y="40" width="70" height="13" uuid="01fcdb71-820f-4ef1-9913-6ddcf36be2dc"/>
<textFieldExpression><![CDATA[$P{toDate} != null ? $P{toDate} : " "]]></textFieldExpression>
</textField>
<textField>
<reportElement x="300" y="5" width="235" height="17" uuid="7eec4f6f-5bfd-4bb0-8888-8cad8d9d84ad"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="14" isBold="true" pdfFontName="Helvetica-Bold"/>
</textElement>
<textFieldExpression><![CDATA[$P{bankName}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="700" y="22" width="30" height="15" uuid="08ba273e-733d-4652-9f7a-83a51f7d78ca"/>
<textElement textAlignment="Right"/>
<text><![CDATA[By:]]></text>
</staticText>
<textField>
<reportElement x="735" y="22" width="55" height="15" uuid="261308a5-7cef-42f8-8880-9d2c9cc5d5ae"/>
<textFieldExpression><![CDATA[$P{userId}]]></textFieldExpression>
</textField>
<line>
<reportElement x="10" y="54" width="780" height="1" uuid="062e928b-20d3-4345-a97e-b16eff81d254"/>
</line>
</band>
</pageHeader>
<columnHeader>
<band height="3" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="3" splitType="Stretch"/>
</detail>
<columnFooter>
<band height="2" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="27">
<textField>
<reportElement x="397" y="5" width="65" height="20" uuid="e40834ac-921f-4171-a500-ebfc9a43124a"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font fontName="Arial" size="10"/>
</textElement>
<textFieldExpression><![CDATA["Page " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band height="273" splitType="Stretch">
<lineChart>
<chart>
<reportElement x..
i am using line chart, how can i split the graph and keeping all the data next pages
maybe you can try to change the "splitType" of summary band to "Immediate"

x axis value displayed in line chart

I have Line chart, in x axis i should display date in string format in full format, but i cant display when more no of values in x axis, for that i decided to display x axis values in vertical manner instead of horizontal , please suggest me. for ref attached image..
<?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="sampl1" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="431d18d3-722a-4aaf-8207-da8bb0ea2fdd">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="51"/>
<parameter name="whereClause" class="java.lang.String"/>
<parameter name="bankLogo" class="java.lang.String"/>
<parameter name="bankName" class="java.lang.String"/>
<parameter name="fromDate" class="java.util.Date">
<parameterDescription><![CDATA[]]></parameterDescription>
</parameter>
<parameter name="toDate" class="java.util.Date"/>
<parameter name="noData" class="java.lang.String"/>
<parameter name="userId" class="java.lang.String"/>
<queryString>
<![CDATA[select avg(jbase_user) as jbaseAvg,AVG(t24_user) as t24Avg,to_char(load_time, 'dd.Mon.yy HH24') as period
from tmc_system_summary group by (to_char(load_time, 'dd.Mon.yy HH24'))]]>
</queryString>
<field name="jbaseavg" class="java.math.BigDecimal"/>
<field name="t24avg" class="java.math.BigDecimal"/>
<field name="period" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="30" splitType="Stretch"/>
</title>
<pageHeader>
<band height="67" splitType="Stretch">
<staticText>
<reportElement x="300" y="22" width="235" height="15" uuid="164831c1-9eff-4cf2-8706-331d28fdf431"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="12" isBold="true" pdfFontName="Helvetica-Bold"/>
</textElement>
<text><![CDATA[ System Summary Report]]></text>
</staticText>
<image>
<reportElement x="12" y="3" width="161" height="30" uuid="513d2931-a2c7-4e54-bb86-188737502cae"/>
<imageExpression><![CDATA[$P{bankLogo}]]></imageExpression>
</image>
<textField pattern="dd/MM/yyyy">
<reportElement x="735" y="2" width="55" height="17" uuid="306ddad6-2b80-4abb-9893-859c59c8ede5"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial"/>
</textElement>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="700" y="2" width="30" height="17" uuid="c6fdbff7-45a5-464e-bcbf-d550b174452f"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="Arial"/>
</textElement>
<text><![CDATA[Date:]]></text>
</staticText>
<staticText>
<reportElement x="20" y="40" width="58" height="14" uuid="5bd47ff1-6b81-428a-b7fd-50e777f70a22"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[From Date:]]></text>
</staticText>
<staticText>
<reportElement x="160" y="40" width="58" height="14" uuid="a7605d9e-c0d1-4a31-8230-c73db35766d4"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[To Date:]]></text>
</staticText>
<textField pattern="dd/MM/yyyy">
<reportElement x="80" y="40" width="70" height="14" uuid="faa13401-da98-4f06-ab43-5a1722d073f7"/>
<textFieldExpression><![CDATA[$P{fromDate} != null ? $P{fromDate} :" "]]></textFieldExpression>
</textField>
<textField pattern="dd/MM/yyyy">
<reportElement x="215" y="40" width="70" height="13" uuid="01fcdb71-820f-4ef1-9913-6ddcf36be2dc"/>
<textFieldExpression><![CDATA[$P{toDate} != null ? $P{toDate} : " "]]></textFieldExpression>
</textField>
<textField>
<reportElement x="300" y="2" width="235" height="17" uuid="7eec4f6f-5bfd-4bb0-8888-8cad8d9d84ad"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="14" isBold="true" pdfFontName="Helvetica-Bold"/>
</textElement>
<textFieldExpression><![CDATA[$P{bankName}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="700" y="22" width="30" height="15" uuid="08ba273e-733d-4652-9f7a-83a51f7d78ca"/>
<textElement textAlignment="Right"/>
<text><![CDATA[By:]]></text>
</staticText>
<textField>
<reportElement x="735" y="22" width="55" height="15" uuid="261308a5-7cef-42f8-8880-9d2c9cc5d5ae"/>
<textFieldExpression><![CDATA[$P{userId}]]></textFieldExpression>
</textField>
<line>
<reportElement x="0" y="54" width="802" height="1" uuid="e17b6ea4-40fd-40ad-861f-a300f926d0e4"/>
</line>
</band>
</pageHeader>
<columnHeader>
<band splitType="Stretch"/>
![enter image description here][1] </columnHeader>
<columnFooter>
<band height="17" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="20" splitType="Stretch">
<textField>
<reportElement x="546" y="1" width="70" height="19" uuid="eeafb0de-dddb-4c9a-8a1d-942b65bf0a7f"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="10"/>
</textElement>
<textFieldExpression><![CDATA["Page " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band height="392" splitType="Stretch">
<lineChart>
<chart>
<reportElement x="12" y="18" width="779" height="355" uuid="f696d665..
By this you can display the x axis value in vertical ( topDown)
<categoryAxisFormat labelRotation="90.0">
it will work.

JasperReports: Subreport renders multiple times, causing duplicate pages

I am using JasperReports to generate a graph and table for a web application using two separate queries. My main JRXML generates the graph, and I include a subreport in the Detail band to generate the table. However, when it renders, the subreport seems to get rendered multiple times (12 to be exact), which results in the generated report being the same graph and table on 12 pages (exact duplicates of each other). This happens both through the online application and iReport.
My main JRXML, subreport JRXML, and report generation code are below (some details have been removed for NDA reasons).
Any insight or ideas on what the issue is would be very helpful.
Main 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="report" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["<<PATH_TO_SUBREPORT>>"]]></defaultValueExpression>
</parameter>
<parameter name="param" class="java.util.Collection" />
<queryString language="SQL">
<![CDATA[<<DATABASE_QUERY>>]]>
</queryString>
<field name="FIELD1" class="java.lang.Integer"/>
<field name="FIELD2" class="java.sql.Date"/>
<field name="FIELD3" class="java.math.BigDecimal"/>
<field name="FIELD4" class="java.math.BigDecimal"/>
<field name="FIELD5" class="java.math.BigDecimal"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="10" splitType="Stretch"/>
</title>
<pageHeader>
<band height="5" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="5" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="513" splitType="Stretch">
<lineChart>
<chart>
<reportElement positionType="Float" x="51" y="0" width="680" height="400"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<categoryDataset>
<categorySeries>
<seriesExpression><![CDATA["FIELD1"]]></seriesExpression>
<categoryExpression><![CDATA[$F{f1}]]></categoryExpression>
<valueExpression><![CDATA[$F{f2}]]></valueExpression>
</categorySeries>
<categorySeries>
<seriesExpression><![CDATA["FIELD2"]]></seriesExpression>
<categoryExpression><![CDATA[$F{f1}]]></categoryExpression>
<valueExpression><![CDATA[$F{f2}]]></valueExpression>
</categorySeries>
<categorySeries>
<seriesExpression><![CDATA["FIELD3"]]></seriesExpression>
<categoryExpression><![CDATA[$F{f1}]]></categoryExpression>
<valueExpression><![CDATA[$F{f2}]]></valueExpression>
</categorySeries>
</categoryDataset>
<linePlot>
<plot labelRotation="-90.0"/>
<categoryAxisFormat labelRotation="-90.0">
<axisFormat>
<tickLabelFont>
<font size="12"/>
</tickLabelFont>
</axisFormat>
</categoryAxisFormat>
<rangeAxisMinValueExpression><![CDATA[0]]></rangeAxisMinValueExpression>
<rangeAxisMaxValueExpression><![CDATA[101]]></rangeAxisMaxValueExpression>
</linePlot>
</lineChart>
<subreport>
<reportElement x="377" y="413" width="425" height="100"/>
<subreportParameter name="param">
<subreportParameterExpression><![CDATA[$P{param}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "testReport.jasper"]]></subreportExpression>
</subreport>
</band>
</detail>
<columnFooter>
<band height="5" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="15" splitType="Stretch">
<textField>
<reportElement mode="Opaque" x="3" y="2" width="759" height="13" backcolor="#E6E6E6"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement mode="Opaque" x="762" y="2" width="40" height="13" backcolor="#E6E6E6"/>
<textElement/>
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField pattern="EEEEE dd MMMMM yyyy">
<reportElement x="3" y="0" width="100" height="13"/>
<textElement/>
<textFieldExpression><![CDATA[new SimpleDateFormat("MM-dd-yyyy").format(
new java.util.Date())]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band height="10" splitType="Stretch"/>
</summary>
</jasperReport>
Sub Report 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="evcas_sub" language="groovy" pageWidth="450" pageHeight="150" columnWidth="10" leftMargin="10" rightMargin="10" topMargin="10" bottomMargin="10">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<style name="table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table_TH" mode="Opaque" backcolor="#0000FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_CH" mode="Opaque" backcolor="#BFBFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
<conditionalStyle>
<conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression>
<style backcolor="#EFEFFF"/>
</conditionalStyle>
</style>
<style name="Crosstab Data Text" hAlign="Center"/>
<parameter name="param" class="java.util.Collection" />
<queryString>
<![CDATA[<<DATABASE_QUERY>>]]>
</queryString>
<field name="FIELD1" class="java.lang.String"/>
<field name="FIELD2" class="java.math.BigDecimal"/>
<field name="FIELD3" class="java.math.BigDecimal"/>
<field name="FIELD4" class="java.math.BigDecimal"/>
<field name="FIELD5" class="java.math.BigDecimal"/>
<field name="FIELD6" class="java.math.BigDecimal"/>
<field name="FIELD7" class="java.math.BigDecimal"/>
<field name="FIELD8" class="java.math.BigDecimal"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="5" splitType="Stretch"/>
</title>
<pageHeader>
<band height="5"/>
</pageHeader>
<columnHeader>
<band height="12">
<textField>
<reportElement style="table_TH" x="0" y="0" width="50" height="12" backcolor="#FFFFFF"/>
<textElement>
<font size="9"/>
<paragraph leftIndent="2"/>
</textElement>
<textFieldExpression><![CDATA["FIELD1"]]></textFieldExpression>
</textField>
<textField>
<reportElement style="table_TH" x="50" y="0" width="50" height="12" backcolor="#FFFFFF"/>
<textElement>
<font size="9"/>
<paragraph leftIndent="2"/>
</textElement>
<textFieldExpression><![CDATA["FIELD2"]]></textFieldExpression>
</textField>
<textField>
<reportElement style="table_TH" x="100" y="0" width="50" height="12" backcolor="#FFFFFF"/>
<textElement>
<font size="9"/>
<paragraph leftIndent="2"/>
</textElement>
<textFieldExpression><![CDATA["FIELD3"]]></textFieldExpression>
</textField>
<textField>
<reportElement style="table_TH" x="150" y="0" width="50" height="12" backcolor="#FFFFFF"/>
<textElement>
<font size="9"/>
<paragraph leftIndent="2"/>
</textElement>
<textFieldExpression><![CDATA["FIELD4"]]></textFieldExpression>
</textField>
<textField>
<reportElement style="table_TH" x="200" y="0" width="50" height="12" backcolor="#FFFFFF"/>
<textElement>
<font size="9"/>
<paragraph leftIndent="2"/>
</textElement>
<textFieldExpression><![CDATA["FIELD5"]]></textFieldExpression>
</textField>
<textField>
<reportElement style="table_TH" x="250" y="0" width="50" height="12" backcolor="#FFFFFF"/>
<textElement>
<font size="9"/>
<paragraph leftIndent="2"/>
</textElement>
<textFieldExpression><![CDATA["FIELD6"]]></textFieldExpression>
</textField>
<textField>
<reportElement style="table_TH" x="300" y="0" width="50" height="12" backcolor="#FFFFFF"/>
<textElement>
<font size="9"/>
<paragraph leftIndent="2"/>
</textElement>
<textFieldExpression><![CDATA["FIELD7"]]></textFieldExpression>
</textField>
<textField>
<reportElement style="table_TH" x="350" y="0" width="50" height="12" backcolor="#FFFFFF"/>
<textElement>
<font size="9"/>
<paragraph leftIndent="2"/>
</textElement>
<textFieldExpression><![CDATA["FIELD8"]]></textFieldExpression>
</textField>
</band>
</columnHeader>
<detail>
<band height="12">
<textField>
<reportElement style="table_CH" x="0" y="0" width="50" height="12" backcolor="#FFFFFF"/>
<textElement>
<font size="8"/>
<paragraph leftIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$F{f1}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="table_CH" x="50" y="0" width="50" height="12" backcolor="#FFFFFF"/>
<textElement>
<font size="8"/>
<paragraph leftIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$F{f2}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="table_CH" x="100" y="0" width="50" height="12" backcolor="#FFFFFF"/>
<textElement>
<font size="8"/>
<paragraph leftIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$F{f3}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="table_CH" x="150" y="0" width="50" height="12" backcolor="#FFFFFF"/>
<textElement>
<font size="8"/>
<paragraph leftIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$F{f4}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="table_CH" x="200" y="0" width="50" height="12" backcolor="#FFFFFF"/>
<textElement>
<font size="8"/>
<paragraph leftIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$F{f5}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="table_CH" x="250" y="0" width="50" height="12" backcolor="#FFFFFF"/>
<textElement>
<font size="8"/>
<paragraph leftIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$F{f6}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="table_CH" x="300" y="0" width="50" height="12" backcolor="#FFFFFF"/>
<textElement>
<font size="8"/>
<paragraph leftIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$F{f7}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="table_CH" x="350" y="0" width="50" height="12" backcolor="#FFFFFF"/>
<textElement>
<font size="8"/>
<paragraph leftIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$F{f8}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="5" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="5" splitType="Stretch"/>
</pageFooter>
</jasperReport>
Rendering Code:
String strFileName = "<<FILENAME>>";
File jrxml = new File(strFileName);
InputStream iStream = new FileInputStream(jrxml);
JasperReport objJReport = JasperCompileManager.compileReport(iStream);
JasperPrint objJPrint = JasperFillManager.fillReport(objJReport, hashMap, datasource.getConnection());
JasperExportManager.exportReportToPdfStream(objJPrint, os);
One detail band is printed per record in your data set. So if your database query returns 12 rows, you get 12 copies of the detail band. Each band uses data from a single row, but this is inconsequential for you as you are using a chart and subreport to display the data.
To avoid this repetition, just put your chart and subreport into a different band. I'd go for column header or footer, but anything except detail will work.