I'm new to jasperreport and currently I don't know how to display sub in master. I searched a lot on this site but i didn't solve my problem.
First, let me note that I load the data from the database in java because I need it later for certain filters...Here is code of class and main.
Class List_A
public class List_A {
private Integer ID_list_A;
private String sektorSvojine;
private String namjenaKoriscenja;
private String brojParcele;
private String osnovni;
private String podbroj;
private Integer brojObjekta;
private Integer broj;
private String plan;
private String skica;
private String nazivPar_ul_kucBr;
private Integer sifraNK;
private String nacinKoriscenja;
private double povrsina;
private double pHa;
private double pA;
private double pM2;
private String pripis;
private String primjedba;
private String listA;
private String koRazmjera;
public List_A(String sektorSvojine, String namjenaKoriscenja, String osnovni, String podbroj, Integer brojObjekta,
String plan, String skica, String nazivPar_ul_kucBr, Integer sifraNK, String nacinKoriscenja, double pHa,
double pA, double pM2, String pripis, String primjedba, String listA, String koRazmjera) {
super();
this.sektorSvojine = sektorSvojine;
this.namjenaKoriscenja = namjenaKoriscenja;
this.osnovni = osnovni;
this.podbroj = podbroj;
this.brojObjekta = brojObjekta;
this.plan = plan;
this.skica = skica;
this.nazivPar_ul_kucBr = nazivPar_ul_kucBr;
this.sifraNK = sifraNK;
this.nacinKoriscenja = nacinKoriscenja;
this.pHa = pHa;
this.pA = pA;
this.pM2 = pM2;
this.pripis = pripis;
this.primjedba = primjedba;
this.listA = listA;
this.koRazmjera = koRazmjera;
}
public String toString() {
return sektorSvojine + " - " + namjenaKoriscenja + " - " + osnovni + " - " + podbroj + " - " + brojObjekta
+ " - " + plan + " - " + skica + " - " + nazivPar_ul_kucBr + " - " + sifraNK + " - " + nacinKoriscenja
+ " - " + pHa + " - " + pA + " - " + pM2 + " - " + pripis + " - " + primjedba + " - " + listA + " - "
+ koRazmjera + "\n";
}
public Integer getID_list_A() {
return ID_list_A;
}
public void setID_list_A(Integer iD_list_A) {
ID_list_A = iD_list_A;
}
public String getSektorSvojine() {
return sektorSvojine;
}
public void setSektorSvojine(String sektorSvojine) {
this.sektorSvojine = sektorSvojine;
}
public String getNamjenaKoriscenja() {
return namjenaKoriscenja;
}
public void setNamjenaKoriscenja(String namjenaKoriscenja) {
this.namjenaKoriscenja = namjenaKoriscenja;
}
public String getBrojParcele() {
return brojParcele;
}
public void setBrojParcele(String brojParcele) {
this.brojParcele = brojParcele;
}
public String getOsnovni() {
return osnovni;
}
public void setOsnovni(String osnovni) {
this.osnovni = osnovni;
}
public String getPodbroj() {
return podbroj;
}
public void setPodbroj(String podbroj) {
this.podbroj = podbroj;
}
public Integer getBrojObjekta() {
return brojObjekta;
}
public void setBrojObjekta(Integer brojObjekta) {
this.brojObjekta = brojObjekta;
}
public Integer getBroj() {
return broj;
}
public void setBroj(Integer broj) {
this.broj = broj;
}
public String getPlan() {
return plan;
}
public void setPlan(String plan) {
this.plan = plan;
}
public String getSkica() {
return skica;
}
public void setSkica(String skica) {
this.skica = skica;
}
public String getNazivPar_ul_kucBr() {
return nazivPar_ul_kucBr;
}
public void setNazivPar_ul_kucBr(String nazivPar_ul_kucBr) {
this.nazivPar_ul_kucBr = nazivPar_ul_kucBr;
}
public Integer getSifraNK() {
return sifraNK;
}
public void setSifraNK(Integer sifraNK) {
this.sifraNK = sifraNK;
}
public String getNacinKoriscenja() {
return nacinKoriscenja;
}
public void setNacinKoriscenja(String nacinKoriscenja) {
this.nacinKoriscenja = nacinKoriscenja;
}
public double getPovrsina() {
return povrsina;
}
public void setPovrsina(double povrsina) {
this.povrsina = povrsina;
}
public double getpHa() {
return pHa;
}
public void setpHa(double pHa) {
this.pHa = pHa;
}
public double getpA() {
return pA;
}
public void setpA(double pA) {
this.pA = pA;
}
public double getpM2() {
return pM2;
}
public void setpM2(double pM2) {
this.pM2 = pM2;
}
public String getPripis() {
return pripis;
}
public void setPripis(String pripis) {
this.pripis = pripis;
}
public String getPrimjedba() {
return primjedba;
}
public void setPrimjedba(String primjedba) {
this.primjedba = primjedba;
}
public String getListA() {
return listA;
}
public void setListA(String listA) {
this.listA = listA;
}
public String getKoRazmjera() {
return koRazmjera;
}
public void setKoRazmjera(String koRazmjera) {
this.koRazmjera = koRazmjera;
}
Class Main
public static void main(String[] args) throws JRException, SQLException {
String jdbcURL...
String username...
String password...
Connection connection = DriverManager.getConnection(jdbcURL, username, password);
String sql = "SELECT * FROM \"Katastar\".\"List_A\"";
Statement statement = connection.createStatement();
ResultSet result = statement.executeQuery(sql);
List<List_A> lista_A = new ArrayList<List_A>();
while (result.next()) {
String svojina = result.getString("Sektor svojine");
String namjena = result.getString("Namjena korišćenja");
String osnovni = result.getString("Osnovni");
String podbroj = result.getString(5);
Integer brObjekta = result.getInt("Broj objekta");
String plan = result.getString(9);
String skica = result.getString("Skica");
String adresa = result.getString("Naziv parcele ili ulica i kućni broj");
Integer sifra = result.getInt("Sifra_NK");
String nacinKor = result.getString("Kultura i klasa ili način koriscenja plodnog zemljista");
double pHa = result.getDouble("P_ha");
double pA = result.getDouble("P_a");
double pm2 = result.getDouble("P_m2");
String pripis = result.getString("Pripis ili otpis u PLN/PL");
String primjedba = result.getString(19);
String listA = result.getString(20);
String razmjera = result.getString("KO_razmjera");
List_A list_A = new List_A(svojina, namjena, osnovni, podbroj, brObjekta, plan, skica, adresa, sifra,
nacinKor, pHa, pA, pm2, pripis, primjedba, listA, razmjera);
lista_A.add(list_A);
}
String Report = "...Master.jrxml";
String reportListA = "...Subreport.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(Report);
JasperReport jasperReportListA = JasperCompileManager.compileReport(reportListA);
Map<String, Object> parameters = new HashMap<>();
JRBeanCollectionDataSource dataSource = new JRBeanCollectionDataSource(lista_A);
parameters.put("ListA", jasperReportListA);
JasperPrint print = JasperFillManager.fillReport(jasperReport, parameters, dataSource);
JasperViewer.viewReport(print);
}
Here is code for Master and Subreport, and how it looks like.
Master
<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="Blank_A4" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="4f9439a6-67bd-4989-b0ed-3880336217a3">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<parameter name="Subreport" class="net.sf.jasperreports.engine.JasperReport"/>
<queryString>
<![CDATA[]]>
</queryString>
<background>
<band splitType="Stretch"/>
</background>
<columnHeader>
<band height="84" splitType="Stretch">
<staticText>
<reportElement x="230" y="20" width="100" height="30" uuid="13388737-4ced-49bf-a0dd-9cc3fa609cc1"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[RADIII]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="100" splitType="Stretch">
<subreport>
<reportElement x="0" y="0" width="550" height="100" uuid="438e179a-d4c3-425a-9190-2660f60b5fd3"/>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA[$P{Subreport}]]></subreportExpression>
</subreport>
</band>
</detail>
Picture how looks Master Report
Subreport
<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="Subreport" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="240c0e51-eb3f-484c-8827-8644ee29a633">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="sektorSvojine" class="java.lang.String"/>
<field name="namjenaKoriscenja" class="java.lang.String"/>
<field name="osnovni" class="java.lang.String"/>
<field name="podbroj" class="java.lang.String"/>
<field name="brojObjekta" class="java.lang.Integer"/>
<field name="plan" class="java.lang.String"/>
<field name="skica" class="java.lang.String"/>
<field name="nazivPar_ul_kucBr" class="java.lang.String"/>
<field name="sifraNK" class="java.lang.Integer"/>
<field name="nacinKoriscenja" class="java.lang.String"/>
<field name="pHa" class="java.lang.Double"/>
<field name="pM2" class="java.lang.Double"/>
<field name="pripis" class="java.lang.String"/>
<field name="primjedba" class="java.lang.String"/>
<field name="pA" class="java.lang.Double"/>
<background>
<band splitType="Stretch"/>
</background>
<columnHeader>
...
</columnHeader>
<detail>
<band height="20" splitType="Stretch">
<textField>
<reportElement x="0" y="0" width="20" height="20" uuid="0b5d9a86-0c24-4d60-a39b-b400af392efc"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.25" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.25" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times Roman Cirilica" size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{sektorSvojine}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="20" y="0" width="28" height="20" uuid="2e6d66f7-d595-420b-9332-7d5705e22473"/>
<box>
<leftPen lineWidth="0.2"/>
<bottomPen lineWidth="1.25"/>
<rightPen lineWidth="0.2"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times Roman Cirilica" size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{namjenaKoriscenja}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="48" y="0" width="35" height="20" uuid="c7aa2847-3755-4afe-9aa4-3d4f6ed8184a"/>
<box>
<leftPen lineWidth="0.2"/>
<bottomPen lineWidth="1.25"/>
<rightPen lineWidth="0.2"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times Roman Cirilica" size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{osnovni}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="83" y="0" width="35" height="20" uuid="68eeec41-8a3f-467d-b189-26eb9eaccb88"/>
<box>
<leftPen lineWidth="0.2"/>
<bottomPen lineWidth="1.25"/>
<rightPen lineWidth="0.2"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times Roman Cirilica" size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{podbroj}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="118" y="0" width="20" height="20" uuid="8dce5833-11b8-47b1-accd-3f3c8027ff89"/>
<box>
<leftPen lineWidth="0.2"/>
<bottomPen lineWidth="1.25"/>
<rightPen lineWidth="0.2"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times Roman Cirilica" size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{brojObjekta}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="138" y="0" width="25" height="20" uuid="033866b8-c2d3-4e61-a17d-9cfb1c6287ac"/>
<box>
<leftPen lineWidth="0.2"/>
<bottomPen lineWidth="1.25"/>
<rightPen lineWidth="0.2"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times Roman Cirilica" size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{plan}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="163" y="0" width="25" height="20" uuid="c9f55fc6-65d5-4108-9f09-2b701729b766"/>
<box>
<leftPen lineWidth="0.2"/>
<bottomPen lineWidth="1.25"/>
<rightPen lineWidth="0.2"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times Roman Cirilica" size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{skica}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="188" y="0" width="90" height="20" uuid="954abe8d-4b3a-42e7-8604-a5179d92b0ea"/>
<box>
<leftPen lineWidth="0.2"/>
<bottomPen lineWidth="1.25"/>
<rightPen lineWidth="0.2"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times Roman Cirilica" size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{nazivPar_ul_kucBrz.toUpperCase()]]></textFieldExpression>
</textField>
<textField>
<reportElement x="278" y="0" width="20" height="20" uuid="79808f35-e88b-43cf-90ae-7d6bc576190a"/>
<box>
<leftPen lineWidth="0.2"/>
<bottomPen lineWidth="1.25"/>
<rightPen lineWidth="0.2"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times Roman Cirilica" size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{sifraNK}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="298" y="0" width="90" height="20" uuid="40bea40e-0437-4d5d-9218-b307ad744eae"/>
<box>
<leftPen lineWidth="0.2"/>
<bottomPen lineWidth="1.25"/>
<rightPen lineWidth="0.2"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times Roman Cirilica" size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{nacinKoriscenjas.toUpperCase()]]></textFieldExpression>
</textField>
<textField>
<reportElement x="388" y="0" width="20" height="20" uuid="e3a4b1bb-5fc7-4a25-8b8b-7bdd13b5035b"/>
<box>
<leftPen lineWidth="0.2"/>
<bottomPen lineWidth="1.25"/>
<rightPen lineWidth="0.2"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times Roman Cirilica" size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{pHa}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="408" y="0" width="20" height="20" uuid="c10f3a24-a2e0-4367-a93c-74cb79ec8a2f"/>
<box>
<leftPen lineWidth="0.2"/>
<bottomPen lineWidth="1.25"/>
<rightPen lineWidth="0.2"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times Roman Cirilica" size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{pA}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="428" y="0" width="20" height="20" uuid="42b3f0ef-e651-48c7-a3c3-645560a1d3be"/>
<box>
<leftPen lineWidth="0.2"/>
<bottomPen lineWidth="1.25"/>
<rightPen lineWidth="0.2"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times Roman Cirilica" size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{pM2}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="448" y="0" width="52" height="20" uuid="71b9b628-0934-4182-b629-31c647ac4651"/>
<box>
<leftPen lineWidth="0.2"/>
<bottomPen lineWidth="1.25"/>
<rightPen lineWidth="0.2"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times Roman Cirilica" size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{pripis}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="500" y="0" width="52" height="20" uuid="495d665c-2a3e-4b24-8a63-49ba1c74754c"/>
<box>
<pen lineWidth="1.25"/>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.25" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.25" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times Roman Cirilica" size="8"/>
</textElement>
<textFieldExpression><![CDATA[$F{primjedba}]]></textFieldExpression>
</textField>
</band>
</detail>
Picture how looks Subreport
When I just want to display the subreport then it fills everything and it's ok, but when I want to display it in the master, only the static text that I have appears, and that's it, the subreport does not appear at all...
Here's what it looks like when I run them separately Subreport and Master
I know i need to do something with the subreport parameters but i can't figure out what... help would mean a lot to me, I will appreciate it.
Related
I am trying to create Jasper Report with crosstab by writing JRXML with DTOs.
I am trying to create rows dynamic number of chargeCodes and their total. It looks something like this:
jobNo
chargeCodeA
chargeCodeB
Total
jobNoABC
100.10
300.30
400.40
jobNoDEF
200.20
400.40
600.60
In my Java backend, I have DTO which looks like this
class MyDTO {
private String jobNo;
private List <String> chargeCode = new ArrayList <> ();
private List <BigDecimal> chargeCodeTotal = new ArrayList <> ();
}
where the list codeCode contains chargeCodeA, chargeCodeB for jobNoABC
and chargeCodeTotal contains 100.10, 300.30 for jobNoABC also.
In my JRXML, I have this:
<?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="vendorBillingCompletedJobReport" leftMargin="5" rightMargin="5">
<parameter name="lblJobNo" class="java.lang.String" isForPrompting="false"/>
<field name="jobNo" class="java.lang.String"/>
<field name="chargeCode" class="java.util.List"/>
<field name="chargeCodeTotal" class="java.util.List"/>
<summary>
<band height="60">
<crosstab>
<reportElement width="782" y="0" x="0" height="60" />
<rowGroup name="jobNo" width="100" totalPosition="End">
<bucket>
<bucketExpression class="java.util.List">
<![CDATA[$F{jobNo}]]>
</bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents>
<box>
<pen lineColor="black" lineWidth="1"/>
</box>
<textField>
<reportElement width="100" y="0" x="0" height="20" />
<textElement textAlignment="Right" verticalAlignment="Middle" />
<textFieldExpression>
<![CDATA[$V{jobNo}]]>
</textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
<crosstabTotalRowHeader>
<cellContents>
<box>
<pen lineColor="black" lineWidth="1"/>
</box>
<staticText>
<reportElement x="0" y="0" width="60" height="20" />
<textElement verticalAlignment="Middle" />
<text>TOTAL</text>
</staticText>
</cellContents>
</crosstabTotalRowHeader>
</rowGroup>
<columnGroup name="chargeCode" height="20" totalPosition="End">
<bucket>
<bucketExpression class="java.util.List">
$F{chargeCode}
</bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents>
<box>
<pen lineColor="black" lineWidth="1"/>
</box>
<textField isStretchWithOverflow="true">
<reportElement width="60" y="0" x="0" height="20" />
<textElement verticalAlignment="Bottom" />
<textFieldExpression>
<![CDATA[$V{chargeCode}]]>
</textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents>
<box>
<pen lineColor="black" lineWidth="1"/>
</box>
<staticText>
<reportElement width="60" y="0" x="0" height="20" />
<textElement verticalAlignment="Bottom" />
<text>TOTAL</text>
</staticText>
</cellContents>
</crosstabTotalColumnHeader>
</columnGroup>
<measure name="chargeCodeTotalCount" class="java.math.BigDecimal" calculation="Sum">
<measureExpression>$F{chargeCodeTotal}</measureExpression>
</measure>
<crosstabCell height="20" width="60">
<cellContents backcolor="#FFFFFF">
<box>
<pen lineColor="black" lineWidth="1"/>
</box>
<textField>
<reportElement x="5" y="0" width="55" height="20" />
<textElement textAlignment="Left" verticalAlignment="Bottom" />
<textFieldExpression class="java.math.BigDecimal">
$V{chargeCodeTotalCount}
</textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
</crosstab>
</band>
</summary>
</jasperReport>
But I am getting error:
java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.Comparable
at org.apache.commons.collections.comparators.ComparableComparator.compare(ComparableComparator.java:91)
I am not sure how to create infinite number of chargeCodes using JRXML.
And I cannot use Dynamic Jasper. I can only think of crosstab. Please help. Thanks.
I have a task to generate PDFs with nodeJS, so i am working with the node-jasper library.
I try to display a table component but when i send dataset from back-end, it keeps showing empty table.
here is my nodjs code:
const express = require('express')
const app = express()
const port = 5000
var jasper = require('node-jasper')({
path: './lib/jasperreports-6.10.0',
reports: {
hw: {
jasper: './jasperFiles/repportBI.jasper',
jrxml: './reports/repportBI.jrxml',
conn: 'in_memory_json'
}
},
});
app.get('/jasper1', (req, res) => {
var report = {
report: 'hw',
data: {
title: "My test report",
Dataset1: jasper.toJsonDataSource(
{
dados: [
{
code: 'e1',
name: 'raouf',
function: 'Developer'
},
{
code: 'e2',
name: 'djamel',
function: 'Developer'
},
{
code: 'e3',
name: 'omar',
function: 'Medecine'
}
]
},
'dados'
),
}
,
dataset: { }
}
var pdf = jasper.pdf(report);
res.set({
'Content-type': 'application/pdf',
'Content-Length': pdf.length
});
res.send(pdf)
});
app.listen(port, () => {
console.log('app is runing on port: ', port)
})
here is my jrxml file:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.10.0.final using JasperReports Library version 6.10.0-unknown -->
<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="repportBI" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="95744304-ed70-4001-8031-6cec31c7acbf">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<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 1_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 1_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="70370722-01b1-41a5-a681-3d6a28fa2f84">
<queryString>
<![CDATA[]]>
</queryString>
<field name="code" class="java.lang.String"/>
<field name="name" class="java.lang.String"/>
<field name="function" class="java.lang.String"/>
</subDataset>
<parameter name="title" class="java.lang.String"/>
<parameter name="datasetTable1" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="code" class="java.lang.String"/>
<field name="name" class="java.lang.String"/>
<field name="function" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="90" splitType="Stretch">
<textField>
<reportElement x="204" y="6" width="147" height="60" uuid="4fc37721-d03e-4f94-9df8-355d2c2ed4e3"/>
<textElement textAlignment="Center">
<font size="26" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{title}]]></textFieldExpression>
</textField>
</band>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="61" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="354" splitType="Stretch">
<componentElement>
<reportElement x="72" y="154" width="200" height="200" uuid="99067366-d9e3-48e1-95b3-a4d8c1e8a1db">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
<property name="com.jaspersoft.studio.table.style.table_header" value="Table 1_TH"/>
<property name="com.jaspersoft.studio.table.style.column_header" value="Table 1_CH"/>
<property name="com.jaspersoft.studio.table.style.detail" value="Table 1_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" whenNoDataType="AllSectionsNoDetail">
<datasetRun subDataset="Dataset1" uuid="7f03ad97-fa43-4b82-94c5-19a674ac7d7e">
<dataSourceExpression><![CDATA[$P{datasetTable1}]]></dataSourceExpression>
</datasetRun>
<jr:column width="66" uuid="40fb6564-12c3-4174-955c-23d808832359">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonne1"/>
<jr:columnHeader style="Table 1_CH" height="30">
<staticText>
<reportElement x="0" y="0" width="66" height="30" uuid="a6e64620-475b-4cd5-a3f6-d7dd711b2ee2"/>
<text><![CDATA[code]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table 1_TD" height="30">
<textField>
<reportElement x="0" y="0" width="66" height="30" uuid="a7d15e3a-2452-4f80-8c20-7fbcc8181fe0"/>
<textFieldExpression><![CDATA[$F{code}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="66" uuid="ba0efa7e-7795-4fd2-9b71-b39f9fdcb466">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonne2"/>
<jr:columnHeader style="Table 1_CH" height="30">
<staticText>
<reportElement x="0" y="0" width="66" height="30" uuid="a694b15b-401f-4e8d-a726-ac8e6ddcaf05"/>
<text><![CDATA[name]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table 1_TD" height="30">
<textField>
<reportElement x="0" y="0" width="66" height="30" uuid="b0fe47b1-8a5c-4df3-8851-6e89da8bfc3a"/>
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="66" uuid="d0dc532f-c2e6-4ff4-8b3e-7a8c8ab0a748">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Colonne3"/>
<jr:columnHeader style="Table 1_CH" height="30">
<staticText>
<reportElement x="0" y="0" width="66" height="30" uuid="32797f1c-a862-4e5f-b624-e1f19af58277"/>
<text><![CDATA[function]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="Table 1_TD" height="30">
<textField>
<reportElement x="0" y="0" width="66" height="30" uuid="ba092f73-109d-4160-b7dc-c664e83366c4"/>
<textFieldExpression><![CDATA[$F{function}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
the generated PDF:
enter image description here
i can't find where the problem is, can you help me please ?
There are two problems here.
The first is that the name of the parameter in report.data (namely Dataset1) doesn't match the name of the parameter in the report (which is datasetTable1). So you'll need this in the JavaScript code:
var report = {
report: 'hw',
data: {
title: "My test report",
datasetTable1: jasper.toJsonDataSource(
...
Then, the type of the datasetTable1 parameter in the report is net.sf.jasperreports.engine.data.JRBeanCollectionDataSource, while jasper.toJsonDataSource produces a net.sf.jasperreports.engine.data.JsonDataSource object. You need to set the parameter type to JsonDataSource or to a more generic type like this:
<parameter name="datasetTable1" class="net.sf.jasperreports.engine.JRDataSource"/>
I'm unable to display list of values in crosstab rowgroup
I have this sample json
{
"header": {
"columnName": [
"Product Store1",
"location"
],
"values": [{
"purchase": {
"name": "bags",
"location": "MainMarket ",
"markets":["1","2","3"]
},
"weekSpend": [{
"weekStartDate": 20181105,
"spend": 100
},
{
"weekStartDate": 20181112,
"spend": 200
}
]
},
{
"purchase": {
"name": "shoes",
"location": "MainMarket ",
"markets":["a","b","c"]
},
"weekSpend": [{
"weekStartDate": 20181105,
"spend": 100
},
{
"weekStartDate": 20181112,
"spend": 200
}
]
}
]
}
i want to show the output of market as row group as list of values Following this post jasper map crosstab crosstabHeaderCell from subdataset different from crosstabdataset
I created crosstab parameter
<crosstabParameter name="listDS" class="net.sf.jasperreports.engine.data.JsonQLDataSource">
<parameterValueExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonQLDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("purchase.markets")]]></parameterValueExpression>
</crosstabParameter>
then referenced this list in row group like this
<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="listSubDataset" uuid="b7fb45d8-2511-483e-9967-dd7efd283a1b">
<dataSourceExpression><![CDATA[$P{listDS}]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="85" width="70">
<textField>
<reportElement x="0" y="0" width="100" height="30" uuid="672350d1-e69e-4ef3-a9da-c36d66646220"/>
<textFieldExpression><![CDATA[$F{colName}]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
but the generated report displays market array as null
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="XTabReport" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="33c43d53-f9b3-4cc9-92b2-bedd805d66a9">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="json_crosstab/DataAdapter.xml"/>
<style name="Crosstab_CH" 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="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>
<subDataset name="XTabDS" uuid="9911fa6c-61b7-4952-81bf-4666e3e17fcf">
<field name="weekStartDate" class="java.lang.Integer">
<property name="net.sf.jasperreports.jsonql.field.expression" value="weekStartDate"/>
</field>
<field name="spend" class="java.lang.Integer">
<property name="net.sf.jasperreports.jsonql.field.expression" value="spend"/>
</field>
<field name="name" class="java.lang.String">
<property name="net.sf.jasperreports.jsonql.field.expression" value="^{2}.purchase.name"/>
</field>
<field name="location" class="java.lang.String">
<property name="net.sf.jasperreports.jsonql.field.expression" value="^{2}.purchase.location"/>
</field>
</subDataset>
<subDataset name="listSubDataset" uuid="01e76955-f29e-4d52-991b-aa0149bfdb37">
<field name="colName" class="java.lang.String">
<property name="net.sf.jasperreports.jsonql.field.expression" value="[0]"/>
</field>
</subDataset>
<queryString language="jsonql">
<![CDATA[]]>
</queryString>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="58">
<staticText>
<reportElement x="140" y="10" width="280" height="30" uuid="c8e3d7ad-eeb0-4cd1-8bef-88874e6921d4"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="14"/>
</textElement>
<text><![CDATA[List inside Crosstab]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="30" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="70" splitType="Stretch">
<crosstab>
<reportElement x="0" y="0" width="560" height="70" uuid="79f2afae-ac8b-4442-ac8e-ae1b1f68109f">
<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"/>
</reportElement>
<crosstabParameter name="listDS" class="net.sf.jasperreports.engine.data.JsonQLDataSource">
<parameterValueExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonQLDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("purchase.markets")]]></parameterValueExpression>
</crosstabParameter>
<crosstabDataset>
<dataset>
<datasetRun subDataset="XTabDS" uuid="73b2e155-5015-451a-8813-7e2ed2f731fb">
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonQLDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("..values..weekSpend.*")]]></dataSourceExpression>
</datasetRun>
</dataset>
</crosstabDataset>
<crosstabHeaderCell>
<cellContents>
<componentElement>
<reportElement x="0" y="0" width="180" height="30" isPrintWhenDetailOverflows="true" uuid="412c6db7-0cfa-4025-80cd-8c450f9eab96">
<property name="net.sf.jasperreports.export.headertoolbar.table.name" value=""/>
</reportElement>
<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="Horizontal">
<datasetRun subDataset="listSubDataset" uuid="a911c80f-a0b3-4395-bbd7-2c52c67585d3">
<dataSourceExpression><![CDATA[$P{listDS}]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="30" width="90">
<textField>
<reportElement x="0" y="0" width="90" height="30" isPrintWhenDetailOverflows="true" uuid="168fd030-81cf-4b80-9766-6f4637c779ec"/>
<box>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
</box>
<textElement>
<paragraph leftIndent="3" spacingBefore="3"/>
</textElement>
<textFieldExpression><![CDATA[$F{colName}]]></textFieldExpression>
</textField>
</jr:listContents>
</jr:list>
</componentElement>
</cellContents>
</crosstabHeaderCell>
<rowGroup name="name" width="90" totalPosition="End">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{name}]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents mode="Opaque" style="Crosstab_CH">
<textField>
<reportElement x="0" y="0" width="90" height="20" uuid="e8aa37d7-0921-40a6-8aca-1cccae61d26d"/>
<textElement>
<paragraph leftIndent="3" spacingBefore="3"/>
</textElement>
<textFieldExpression><![CDATA[$V{name}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
<crosstabTotalRowHeader>
<cellContents/>
</crosstabTotalRowHeader>
</rowGroup>
<rowGroup name="location" width="90" totalPosition="End">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{location}]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents mode="Opaque" style="Crosstab_CH">
<textField>
<reportElement x="0" y="0" width="90" height="20" uuid="86107a55-79be-4170-a2ee-b2a0ae5315e2"/>
<textElement>
<paragraph leftIndent="3" spacingBefore="3"/>
</textElement>
<textFieldExpression><![CDATA[$V{location}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
<crosstabTotalRowHeader>
<cellContents/>
</crosstabTotalRowHeader>
</rowGroup>
<columnGroup name="weekStartDate" height="30" totalPosition="End">
<bucket class="java.lang.Integer">
<bucketExpression><![CDATA[$F{weekStartDate}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents mode="Opaque" style="Crosstab_CH">
<textField>
<reportElement x="0" y="0" width="90" height="30" uuid="c65fb64a-d89b-4cc3-be28-d76624cb3d93"/>
<textElement>
<paragraph leftIndent="3" spacingBefore="3"/>
</textElement>
<textFieldExpression><![CDATA[$V{weekStartDate}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents/>
</crosstabTotalColumnHeader>
</columnGroup>
<measure name="spend_MEASURE" class="java.lang.Integer">
<measureExpression><![CDATA[$F{spend}]]></measureExpression>
</measure>
<crosstabCell width="90" height="20">
<cellContents mode="Opaque" style="Crosstab_CD">
<textField>
<reportElement x="0" y="0" width="90" height="20" uuid="efb4b6dd-d9d3-4520-a94e-c0010a572b29"/>
<textElement>
<paragraph leftIndent="3" spacingBefore="3"/>
</textElement>
<textFieldExpression><![CDATA[$V{spend_MEASURE}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell height="20" columnTotalGroup="weekStartDate">
<cellContents/>
</crosstabCell>
<crosstabCell width="90" height="0" rowTotalGroup="location">
<cellContents/>
</crosstabCell>
<crosstabCell height="0" rowTotalGroup="location" columnTotalGroup="weekStartDate">
<cellContents/>
</crosstabCell>
<crosstabCell width="90" height="20" rowTotalGroup="name">
<cellContents/>
</crosstabCell>
<crosstabCell height="20" rowTotalGroup="name" columnTotalGroup="weekStartDate">
<cellContents/>
</crosstabCell>
</crosstab>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
excepted output is
but actual output is
Jasperreports Studio throws a runtime error during preview when the contents of a table cell (Text field) is large. Important thing here is that the Text field need to have its Stretch With Overflow property set to True
Following is the exception thrown:
net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.JRRuntimeException: Infinite loop creating new page due to column header overflow.
at com.jaspersoft.studio.editor.preview.view.control.ReportController.fillReport(ReportController.java:536)
at com.jaspersoft.studio.editor.preview.view.control.ReportController.access$17(ReportController.java:511)
at com.jaspersoft.studio.editor.preview.view.control.ReportController$1.run(ReportController.java:429)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
Caused by: net.sf.jasperreports.engine.JRRuntimeException: Infinite loop creating new page due to column header overflow.
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnHeader(JRVerticalFiller.java:534)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:154)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:615)
at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:822)
at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:61)
at net.sf.jasperreports.engine.fill.AbstractThreadSubreportRunner.run(AbstractThreadSubreportRunner.java:221)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
This issue can be reproduced in multiple ways but I am using simplest scenario. I have attached simple jrxml file for reference. I have used a table with empty data set. I have used Text Field expression to display data. I have set isStretchWithOverflow to true.
JRXML
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Table_Based" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="66519d71-4f27-4833-9a1d-c9b72e811f0c">
<property name="template.engine" value="tabular_template"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Sample DB"/>
<style name="Title" fontName="Times New Roman" fontSize="50" isBold="true"/>
<style name="SubTitle" forecolor="#736343" fontName="Arial" fontSize="18"/>
<style name="Column header" forecolor="#666666" fontName="Arial" fontSize="12" isBold="true"/>
<style name="Row" mode="Transparent">
<conditionalStyle>
<conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 0]]></conditionExpression>
<style backcolor="#E6DAC3"/>
</conditionalStyle>
</style>
<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="#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="tableDataset" uuid="bcc32bbf-2279-43e0-8149-66ee3e913b5e">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="Sample DB"/>
<queryString language="SQL">
<![CDATA[]]>
</queryString>
</subDataset>
<subDataset name="Dataset1" uuid="13d74fad-eb9b-446f-a81d-55b8cf6ea0db">
<queryString>
<![CDATA[]]>
</queryString>
</subDataset>
<queryString>
<![CDATA[]]>
</queryString>
<title>
<band height="113" splitType="Stretch">
<staticText>
<reportElement style="Title" x="270" y="0" width="263" height="62" uuid="a080d2ca-6207-4d8e-87c9-d3b61fb495a9"/>
<textElement verticalAlignment="Middle"/>
<text><![CDATA[Report Title]]></text>
</staticText>
<staticText>
<reportElement style="SubTitle" x="303" y="62" width="196" height="22" uuid="0d849401-f944-4163-9df0-f69408a0618a"/>
<textElement>
<font fontName="Times New Roman"/>
</textElement>
<text><![CDATA[Report SubTitle]]></text>
</staticText>
</band>
</title>
<summary>
<band height="112" splitType="Stretch">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.grid.JSSGridBagLayout"/>
<componentElement>
<reportElement stretchType="ContainerBottom" x="0" y="0" width="802" height="112" isPrintWhenDetailOverflows="true" uuid="f3767496-0434-4f42-862b-5839d580e423">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/>
<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"/>
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd" whenNoDataType="AllSectionsNoDetail">
<datasetRun subDataset="Dataset1" uuid="05c4f663-c370-4c53-b332-ae9dfb9590e0"/>
<jr:column width="170" uuid="a3e3c62f-3558-42a1-a701-ad31853970a9">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/>
<jr:tableHeader style="Table_TH" height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="170" height="30" uuid="a5ddd2d9-992d-41d2-a7d0-4cc7ec29350b"/>
<textElement>
<font size="20"/>
</textElement>
<text><![CDATA[Number]]></text>
</staticText>
</jr:tableHeader>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1">
<textField>
<reportElement positionType="Float" stretchType="ElementGroupHeight" x="0" y="0" width="170" height="30" uuid="b4f24d97-8dbe-42e8-81a8-34fb336eabef"/>
<textFieldExpression><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression>
</textField>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="40" rowSpan="1"/>
</jr:column>
<jr:column width="173" uuid="e2eaa014-ebfd-4795-b752-476ca2fa8f0b">
<property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
<jr:tableHeader style="Table_TH" height="30" rowSpan="1">
<staticText>
<reportElement x="0" y="0" width="173" height="30" uuid="b80ae7ce-3491-45cd-963d-8638f03a3891"/>
<textElement>
<font size="20"/>
</textElement>
<text><![CDATA[Text]]></text>
</staticText>
</jr:tableHeader>
<jr:columnHeader style="Table_CH" height="30" rowSpan="1">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" x="0" y="0" width="173" height="30" isPrintWhenDetailOverflows="true" uuid="a2647f94-9054-4efd-904e-0850eead4cdf"/>
<textElement>
<paragraph lineSpacing="1_1_2"/>
</textElement>
<textFieldExpression><![CDATA[UPPER("qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm")]]></textFieldExpression>
</textField>
</jr:columnHeader>
<jr:detailCell style="Table_TD" height="40">
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</summary>
In similarly scenario Jasperreports server throws a different runtime exception:
It appears to be some kind of bug. Any help would be great help.
2018-09-21 17:03:26,667 ERROR RenderViewExceptionInterceptor,http-nio-8080-exec-8:55 - Internal server error occurred. Please contact your system administrator.
java.lang.NullPointerException
at net.sf.jasperreports.components.table.util.TableUtil.getAllColumns(TableUtil.java:162)
at net.sf.jasperreports.components.headertoolbar.json.HeaderToolbarElementJsonHandler.getColumnGroupsData(HeaderToolbarElementJsonHandler.java:832)
at net.sf.jasperreports.components.headertoolbar.json.HeaderToolbarElementJsonHandler.getJsonFragment(HeaderToolbarElementJsonHandler.java:237)
at net.sf.jasperreports.engine.export.JsonExporter.exportGenericElement(JsonExporter.java:487)
You need to redesign your report.
Currently you want a column header on each page, but your column header does not fit on page, so what happens is.
Create column header (because start of table or new page)
Break to new page (since it does not fit).
Go to 1 since new page.
net.sf.jasperreports.engine.JRRuntimeException: Infinite loop creating new page due to column header overflow.
Your solution can be all from making text smaller, column larger or truncate text so that it fits in page.
I am trying below JRXML to render data from CSV datasource. This JRXML has bar chart as well as table taking data from same CSV datasource. Bar chart is getting rendered without any issue, but table is not getting rendered. Please advise.
I am using Jaspersoft Studio 5.1.0 for report development.
My JRXML:
<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="AEReport_1" pageWidth="800" pageHeight="842" columnWidth="760" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="155eb524-de3b-4d18-98af-83ffc65bff68">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="V2_FLAT_FILE_CSV"/>
<style name="table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table_TH" mode="Opaque" backcolor="#B8860B">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_CH" mode="Opaque" backcolor="#FFEDBF">
<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="#FFFAEF"/>
</conditionalStyle>
</style>
<style name="table 1">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table 1_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 1_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 1_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 2">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table 2_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 2_CH" mode="Opaque" backcolor="#BFE1FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 2_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 3">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table 3_TH" mode="Opaque" backcolor="#BD955F">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 3_CH" mode="Opaque" backcolor="#E6DCCF">
<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>
<conditionalStyle>
<conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression>
<style backcolor="#F8F6F3"/>
</conditionalStyle>
</style>
<style name="table 4">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table 4_TH" mode="Opaque" backcolor="#D2B48C">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 4_CH" mode="Opaque" backcolor="#FFE4BF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 4_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="#FFF8EF"/>
</conditionalStyle>
</style>
<style name="table 5">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table 5_TH" mode="Opaque" backcolor="#BD955F">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 5_CH" mode="Opaque" backcolor="#E6DCCF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table 5_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="#F8F6F3"/>
</conditionalStyle>
</style>
<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>
<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 1_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 1_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>
<conditionalStyle>
<conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression>
<style backcolor="#FBFDFF"/>
</conditionalStyle>
</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 2_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 2_TD" mode="Opaque" backcolor="#FFFFFF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
<topPen lineWidth="0.5" lineColor="#000000"/>
<leftPen lineWidth="0.5" lineColor="#000000"/>
<bottomPen lineWidth="0.5" lineColor="#000000"/>
<rightPen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="Table 3_TH" mode="Opaque" backcolor="#DEB887">
<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="#FFE3BF">
<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>
<conditionalStyle>
<conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]></conditionExpression>
<style backcolor="#F6EDE1"/>
</conditionalStyle>
</style>
<subDataset name="Table Dataset 1" uuid="3e8114ed-92a8-4069-89a5-fbdb253c6ce9"/>
<subDataset name="Table Dataset A" uuid="2e726566-2d24-49ba-84bb-5994c8f9d50b">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="V2_FLAT_FILE_CSV"/>
<parameter name="dateFrom" class="java.lang.String"/>
<parameter name="dateTo" class="java.lang.String"/>
<queryString language="csv">
<![CDATA[]]>
</queryString>
<field name="COUNT" class="java.math.BigDecimal"/>
<field name="ANLYS_DATE" class="java.lang.String"/>
<field name="APP_MNEMONIC" class="java.lang.String"/>
</subDataset>
<subDataset name="Table Dataset B" uuid="9b3ebb93-6694-430d-80fe-625fdfaae930">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="V2_FLAT_FILE_CSV"/>
<parameter name="dateFrom" class="java.lang.String"/>
<parameter name="dateTo" class="java.lang.String"/>
<queryString language="csv">
<![CDATA[]]>
</queryString>
<field name="COUNT" class="java.math.BigDecimal"/>
<field name="ANLYS_DATE" class="java.lang.String"/>
<field name="APP_MNEMONIC" class="java.lang.String"/>
<group name="APP_MNEMONIC">
<groupExpression><![CDATA[$F{APP_MNEMONIC}]]></groupExpression>
</group>
<group name="ANLYS_DATE">
<groupExpression><![CDATA[$F{ANLYS_DATE}]]></groupExpression>
</group>
</subDataset>
<parameter name="dateFrom" class="java.lang.String"/>
<parameter name="dateTo" class="java.lang.String"/>
<parameter name="reportUser" class="java.lang.String"/>
<queryString language="csv">
<![CDATA[]]>
</queryString>
<field name="COUNT" class="java.math.BigDecimal"/>
<field name="ANLYS_DATE" class="java.lang.String"/>
<field name="APP_MNEMONIC" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch">
<image>
<reportElement uuid="667e0ea3-a911-4d00-8067-2e89b3780fda" x="0" y="0" width="136" height="54"/>
<imageExpression><![CDATA["C:\\Users\\ADCXDPF\\Desktop\\bnymellon.png"]]></imageExpression>
</image>
<textField pattern="">
<reportElement uuid="7a842faa-9b66-489a-90ad-5375cd1272de" x="230" y="30" width="253" height="33"/>
<textElement textAlignment="Center">
<font size="16" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Throughput Summary Report"]]></textFieldExpression>
</textField>
</band>
</title>
<pageHeader>
<band height="100" splitType="Stretch">
<textField>
<reportElement uuid="d119d0a9-8b20-4a5e-aee6-e16cee9b228c" x="100" y="43" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$P{dateFrom}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="c931fbfb-d41d-4890-979d-570cdd1d3d49" x="0" y="4" width="100" height="20"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[Report Parameters]]></text>
</staticText>
<textField>
<reportElement uuid="496c107b-9e9f-4e50-8cf4-0d158c2d3c1d" x="100" y="24" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$P{reportUser}]]></textFieldExpression>
</textField>
<staticText>
<reportElement uuid="f89feee2-3b9d-43cf-b738-386b96dd005c" x="0" y="24" width="100" height="20"/>
<textElement/>
<text><![CDATA[User :]]></text>
</staticText>
<staticText>
<reportElement uuid="56beec91-5509-4cdb-8155-54dfae54296f" x="0" y="43" width="100" height="20"/>
<textElement/>
<text><![CDATA[Date From :]]></text>
</staticText>
<staticText>
<reportElement uuid="a0cc21e8-1610-4f72-b729-f90648762326" x="0" y="63" width="100" height="20"/>
<textElement/>
<text><![CDATA[Date To : ]]></text>
</staticText>
<textField>
<reportElement uuid="b9df36a8-4fac-4eb4-91a2-970179703202" x="100" y="63" width="100" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$P{dateTo}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<detail>
<band height="549" splitType="Stretch">
<printWhenExpression><![CDATA[$V{REPORT_COUNT} == 1]]></printWhenExpression>
<line>
<reportElement uuid="64346d62-eee3-493a-b044-39c4b06419d4" x="-18" y="257" width="778" height="1"/>
</line>
<line>
<reportElement uuid="51143f56-11c9-4c86-adaf-6a9567e55dcd" x="-18" y="4" width="778" height="3"/>
</line>
<staticText>
<reportElement uuid="d649fb76-7f5b-4777-ba74-eec842bc3620" x="200" y="7" width="159" height="20"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Activity Summary By Date]]></text>
</staticText>
<barChart>
<chart isShowLegend="false" evaluationTime="Report">
<reportElement uuid="21819f57-e2b0-4d97-b0c3-212eaeb45b81" x="-1" y="37" width="521" height="208"/>
<chartTitle>
<titleExpression><![CDATA[]]></titleExpression>
</chartTitle>
<chartSubtitle/>
<chartLegend/>
</chart>
<categoryDataset>
<categorySeries>
<seriesExpression><![CDATA[$F{ANLYS_DATE}]]></seriesExpression>
<categoryExpression><![CDATA[$F{ANLYS_DATE}]]></categoryExpression>
<valueExpression><![CDATA[$F{COUNT}]]></valueExpression>
</categorySeries>
</categoryDataset>
<barPlot isShowTickMarks="false">
<plot>
<seriesColor seriesOrder="0" color="#B08057"/>
<seriesColor seriesOrder="1" color="#8599A8"/>
<seriesColor seriesOrder="2" color="#94996E"/>
<seriesColor seriesOrder="3" color="#667D78"/>
<seriesColor seriesOrder="4" color="#8F6678"/>
<seriesColor seriesOrder="5" color="#A3A19E"/>
</plot>
<itemLabel/>
<categoryAxisLabelExpression><![CDATA["Processing Date"]]></categoryAxisLabelExpression>
<categoryAxisFormat>
<axisFormat>
<labelFont>
<font isBold="true"/>
</labelFont>
</axisFormat>
</categoryAxisFormat>
<valueAxisLabelExpression><![CDATA["Total Hit"]]></valueAxisLabelExpression>
<valueAxisFormat>
<axisFormat>
<labelFont>
<font isBold="true"/>
</labelFont>
</axisFormat>
</valueAxisFormat>
</barPlot>
</barChart>
<lineChart>
<chart isShowLegend="true">
<reportElement uuid="41772b49-87de-4350-9ad0-00a78f5246d0" x="1" y="288" width="459" height="207"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<categoryDataset>
<categorySeries>
<seriesExpression><![CDATA[$F{APP_MNEMONIC}]]></seriesExpression>
<categoryExpression><![CDATA[$F{ANLYS_DATE}]]></categoryExpression>
<valueExpression><![CDATA[$F{COUNT}]]></valueExpression>
</categorySeries>
</categoryDataset>
<linePlot>
<plot>
<seriesColor seriesOrder="0" color="#B08057"/>
<seriesColor seriesOrder="1" color="#8599A8"/>
<seriesColor seriesOrder="2" color="#94996E"/>
<seriesColor seriesOrder="3" color="#667D78"/>
<seriesColor seriesOrder="4" color="#8F6678"/>
<seriesColor seriesOrder="5" color="#A3A19E"/>
</plot>
<categoryAxisLabelExpression><![CDATA["Processing Date"]]></categoryAxisLabelExpression>
<categoryAxisFormat>
<axisFormat>
<labelFont>
<font isBold="true"/>
</labelFont>
<tickLabelFont>
<font isBold="true"/>
</tickLabelFont>
</axisFormat>
</categoryAxisFormat>
<valueAxisLabelExpression><![CDATA["Total Hit"]]></valueAxisLabelExpression>
<valueAxisFormat>
<axisFormat>
<labelFont>
<font isBold="true"/>
</labelFont>
</axisFormat>
</valueAxisFormat>
</linePlot>
</lineChart>
<staticText>
<reportElement uuid="72fb52e9-7c93-40bc-a6eb-3adcf0f5c10f" x="200" y="260" width="193" height="20"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Activity Summary By Application]]></text>
</staticText>
<componentElement>
<reportElement uuid="6bd73234-2b4b-4f40-a95b-43b0f04a041e" x="540" y="20" width="200" height="160" isRemoveLineWhenBlank="true" isPrintInFirstWholeBand="true"/>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="Table Dataset A" uuid="4ca25032-c8da-46c0-a75f-0ad3f60b0571">
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column width="100" uuid="fbb13626-5aad-4322-ba9e-80cdfe4a55e8">
<jr:tableHeader style="Table 3_TH" height="30"/>
<jr:tableFooter style="Table 3_TH" height="30"/>
<jr:columnHeader style="Table 3_CH" height="30">
<staticText>
<reportElement uuid="403cc6c2-c57e-4741-840d-57c1269a7551" x="0" y="0" width="100" height="30"/>
<textElement/>
<text><![CDATA[ANLYS_DATE]]></text>
</staticText>
</jr:columnHeader>
<jr:columnFooter style="Table 3_CH" height="30"/>
<jr:detailCell style="Table 3_TD" height="30">
<textField>
<reportElement uuid="c80f6de6-0114-482b-91d2-d0ffee0c5481" x="0" y="0" width="100" height="30"/>
<textElement/>
<textFieldExpression><![CDATA[$F{ANLYS_DATE}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="100" uuid="07468b4f-03a5-4f62-97c8-a0489c687664">
<jr:tableHeader style="Table 3_TH" height="30"/>
<jr:tableFooter style="Table 3_TH" height="30"/>
<jr:columnHeader style="Table 3_CH" height="30">
<staticText>
<reportElement uuid="3e081981-714d-434b-b7eb-2a0109559506" x="0" y="0" width="100" height="30"/>
<textElement/>
<text><![CDATA[COUNT]]></text>
</staticText>
</jr:columnHeader>
<jr:columnFooter style="Table 3_CH" height="30"/>
<jr:detailCell style="Table 3_TD" height="30">
<textField>
<reportElement uuid="0fba778b-3de3-49fb-8176-97ff6d73a785" x="0" y="0" width="100" height="30"/>
<textElement/>
<textFieldExpression><![CDATA[$F{COUNT}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</detail>
<pageFooter>
<band height="31" splitType="Stretch">
<staticText>
<reportElement uuid="e8424fab-a95e-4c89-8af0-a0d12a89ff1b" x="1" y="9" width="100" height="20"/>
<textElement/>
<text><![CDATA[Run Date :]]></text>
</staticText>
<textField>
<reportElement uuid="2abd8771-abef-4722-8526-69abf4e81630" x="633" y="9" width="80" height="20"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement uuid="a1bb581a-8214-4074-be04-5493e100c787" x="713" y="9" width="40" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField pattern="MM/dd/yyyy HH:mm:ss">
<reportElement uuid="dbacf251-c81f-4e05-82ab-029d82139e0b" x="51" y="9" width="164" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
</band>
</pageFooter>
</jasperReport>
CSV data is:
"COUNT","ANLYS_DATE","APP_MNEMONIC"
9932,"2013-08-27","ESD"
1132,"2013-08-26","ESD"
2532,"2013-08-25","ESD"
902,"2013-08-27","JMETER"
920,"2013-08-26","JMETER"
1120,"2013-08-25","JMETER"
1109,"2013-08-27","LND"
2229,"2013-08-26","LND"
9999,"2013-08-25","LND"
11646,"2013-08-24","SPU"
1646,"2013-08-26","SPU"
111646,"2013-08-27","SPU"
Please try this
You need a subdatset for the Table
Right click on the Table .Edit table datasource. Choose the datasource you need. In the connection/Datasource Expression
Choose -->"Use datasource Expression"
Use the following in the expression
((net.sf.jasperreports.engine.data.JRCsvDataSource) $P{REPORT_DATA_SOURCE})
Thanks