Jasper horizontal bar chart data overflowing - jasper-reports

I have created a jasper report with following 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="SUB_MS_ICM_SUMMERY" language="groovy" pageWidth="842" pageHeight="590" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="0.75"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<subDataset name="incident_category_1">
<parameter name="start_date" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="end_date" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[select category,count from (SELECT 'Total' As category,COUNT(*) as count FROM ms_icm_incident i
where incident_category<>3 and status <> 'Cancelled' and (trunc(nvl(i.initiated_on,$P{start_date})) between to_char(to_date($P{start_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy') and to_char(to_date($P{end_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy'))
union
select decode(inc.incident_category,1,'Actual Incident',2,'Near Hit')
,count(inc.incident_id) as cnt
from ms_icm_incident inc
where inc.incident_category <>3 and inc.status<>'Cancelled'
and (trunc(nvl(inc.initiated_on,$P{start_date})) between to_char(to_date($P{start_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy') and to_char(to_date($P{end_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy'))
group by inc.incident_category
union
SELECT decode(lov.STORED_VALUE,1,'Actual Incident',2,'Near Hit') as incident_category, 0 as cnt
FROM ms_local_lov_t lov
WHERE LOV_NAME='MS_ICM_CATEGORY' and lov.STORED_VALUE <>3
and lov.STORED_VALUE not in (select inc.incident_category
from ms_icm_incident inc
where inc.incident_category <>3 and inc.status<>'Cancelled'
and (trunc(nvl(inc.initiated_on,$P{start_date})) between to_char(to_date($P{start_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy') and to_char(to_date($P{end_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy'))))
order by decode(category,'Total',1 )]]>
</queryString>
<field name="CATEGORY" class="java.lang.String"/>
<field name="COUNT" class="java.math.BigDecimal"/>
</subDataset>
<subDataset name="incident_severity_1">
<parameter name="start_date" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="end_date" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[select severity, sum(cnt) from
(select POTENTIAL_SEVERITY_CALCULATED as severity, count(*) as cnt
from ms_icm_incident where incident_category<>3 and POTENTIAL_SEVERITY_CALCULATED is not null and status <> 'Cancelled' and(trunc(nvl(initiated_on,$P{start_date})) between to_char(to_date($P{start_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy') and to_char(to_date($P{end_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy'))
group by POTENTIAL_SEVERITY_CALCULATED)
dual group by severity
order by decode(severity,'High',1,'Medium',2,'Low',3)]]>
</queryString>
<field name="SEVERITY" class="java.lang.String"/>
<field name="SUM(CNT)" class="java.math.BigDecimal"/>
</subDataset>
<subDataset name="Incident_status_1">
<parameter name="start_date" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="end_date" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[select status,cnt from (select status, count(*) as cnt from ms_icm_incident
where incident_category<>3 and (trunc(nvl(initiated_on,$P{start_date})) between to_char(to_date($P{start_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy') and to_char(to_date($P{end_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy'))and status <> 'Cancelled'
group by status
union
select status, cnt from (select distinct status,0 as cnt from ms_icm_flow_action_status
union
select 'Closed',0 as cnt from dual) where STATUS NOT IN
(select status from ms_icm_incident
where incident_category<>3 and (trunc(nvl(initiated_on,$P{start_date})) between to_char(to_date($P{start_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy') and to_char(to_date($P{end_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy'))and status <> 'Cancelled'
group by status)and status not in ( 'Cancelled','OHS Investigating','Initiating Incident')
)
order by decode (status,
'Initiated',1,
'Initiated - Need More Info',2,
'Preliminary',3,
'Investigating',4,
'Draft Report Review',5,
'Final Report Review',6,
'Re-Investigating',7,
'Final',8,
'Closed',9,
'Completed',10)]]>
</queryString>
<field name="STATUS" class="java.lang.String"/>
<field name="CNT" class="java.math.BigDecimal"/>
</subDataset>
<parameter name="start_date" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="end_date" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[SELECT 'Total' As category,COUNT(*) as count FROM ms_icm_incident i
where incident_category<>3 and (trunc(nvl(i.initiated_on,$P{start_date})) between to_char(to_date($P{start_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy') and to_char(to_date($P{end_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy'))
union
select (SELECT lov.DISPLAYED_VALUE
FROM ms_local_lov_t lov
WHERE lov.STORED_VALUE=i.incident_category
and LOV_NAME='MS_ICM_CATEGORY')as category, count(*) from ms_icm_incident i
where incident_category<>3 and (trunc(nvl(i.initiated_on,$P{start_date})) between to_char(to_date($P{start_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy') and to_char(to_date($P{end_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy'))
group by incident_category]]>
</queryString>
<field name="CATEGORY" class="java.lang.String"/>
<field name="COUNT" class="java.math.BigDecimal"/>
<background>
<band splitType="Stretch"/>
</background>
<columnHeader>
<band height="505">
<barChart>
<chart isShowLegend="false">
<reportElement x="15" y="191" width="772" height="280"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<categoryDataset>
<dataset>
<datasetRun subDataset="incident_severity_1">
<datasetParameter name="start_date">
<datasetParameterExpression><![CDATA[$P{start_date}]]></datasetParameterExpression>
</datasetParameter>
<datasetParameter name="end_date">
<datasetParameterExpression><![CDATA[$P{end_date}]]></datasetParameterExpression>
</datasetParameter>
</datasetRun>
</dataset>
<categorySeries>
<seriesExpression><![CDATA[$F{SEVERITY}]]></seriesExpression>
<categoryExpression><![CDATA[$F{SEVERITY}]]></categoryExpression>
<valueExpression><![CDATA[$F{SUM(CNT)}]]></valueExpression>
</categorySeries>
</categoryDataset>
<barPlot>
<plot orientation="Horizontal" labelRotation="0.0"/>
<itemLabel/>
<valueAxisFormat>
<axisFormat labelColor="#000000" tickLabelColor="#000000" verticalTickLabels="false" axisLineColor="#000000"/>
</valueAxisFormat>
<rangeAxisMinValueExpression><![CDATA[0]]></rangeAxisMinValueExpression>
<rangeAxisMaxValueExpression><![CDATA[$F{COUNT}]]></rangeAxisMaxValueExpression>
</barPlot>
</barChart>
<barChart>
<chart isShowLegend="false">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="45" width="802" height="113" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<categoryDataset>
<dataset>
<datasetRun subDataset="incident_category_1">
<datasetParameter name="start_date">
<datasetParameterExpression><![CDATA[$P{start_date}]]></datasetParameterExpression>
</datasetParameter>
<datasetParameter name="end_date">
<datasetParameterExpression><![CDATA[$P{end_date}]]></datasetParameterExpression>
</datasetParameter>
</datasetRun>
</dataset>
<categorySeries>
<seriesExpression><![CDATA[$F{CATEGORY}]]></seriesExpression>
<categoryExpression><![CDATA[$F{CATEGORY}]]></categoryExpression>
<valueExpression><![CDATA[$F{COUNT}]]></valueExpression>
</categorySeries>
</categoryDataset>
<barPlot isShowLabels="true" isShowTickLabels="true" isShowTickMarks="true">
<plot orientation="Horizontal" labelRotation="0.0"/>
<itemLabel/>
<rangeAxisMinValueExpression><![CDATA[0]]></rangeAxisMinValueExpression>
<rangeAxisMaxValueExpression><![CDATA[$F{COUNT}]]></rangeAxisMaxValueExpression>
</barPlot>
</barChart>
<staticText>
<reportElement mode="Opaque" x="2" y="0" width="795" height="33" forecolor="#FF0000" backcolor="#00CCCC"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.0"/>
<leftPen lineWidth="0.0"/>
<bottomPen lineWidth="0.0"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="18" isBold="true" pdfFontName="Helvetica-Bold" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Incident Category ]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="1" y="158" width="795" height="33" forecolor="#FF0000" backcolor="#00CCCC"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.0"/>
<leftPen lineWidth="0.0"/>
<bottomPen lineWidth="0.0"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="18" isBold="true" pdfFontName="Helvetica-Bold" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Incident Severity]]></text>
</staticText>
</band>
</columnHeader>
<summary>
<band height="507" splitType="Stretch">
<barChart>
<chart isShowLegend="false">
<reportElement x="4" y="43" width="783" height="404"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<categoryDataset>
<dataset>
<datasetRun subDataset="Incident_status_1">
<datasetParameter name="start_date">
<datasetParameterExpression><![CDATA[$P{start_date}]]></datasetParameterExpression>
</datasetParameter>
<datasetParameter name="end_date">
<datasetParameterExpression><![CDATA[$P{end_date}]]></datasetParameterExpression>
</datasetParameter>
</datasetRun>
</dataset>
<categorySeries>
<seriesExpression><![CDATA[$F{STATUS}]]></seriesExpression>
<categoryExpression><![CDATA[$F{STATUS}]]></categoryExpression>
<valueExpression><![CDATA[$F{CNT}]]></valueExpression>
</categorySeries>
</categoryDataset>
<barPlot>
<plot orientation="Horizontal" labelRotation="0.0"/>
<itemLabel/>
<valueAxisFormat>
<axisFormat labelColor="#000000" tickLabelColor="#000000" verticalTickLabels="false" axisLineColor="#000000"/>
</valueAxisFormat>
<rangeAxisMinValueExpression><![CDATA[0]]></rangeAxisMinValueExpression>
<rangeAxisMaxValueExpression><![CDATA[$F{COUNT}]]></rangeAxisMaxValueExpression>
</barPlot>
</barChart>
<staticText>
<reportElement mode="Opaque" x="2" y="0" width="795" height="33" forecolor="#FF0000" backcolor="#00CCCC"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.0"/>
<leftPen lineWidth="0.0"/>
<bottomPen lineWidth="0.0"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="18" isBold="true" pdfFontName="Helvetica-Bold" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Incident Status]]></text>
</staticText>
<image>
<reportElement x="0" y="457" width="799" height="50"/>
<imageExpression><![CDATA["MSI.png"]]></imageExpression>
</image>
</band>
</summary>
</jasperReport>
Now i am getting the chart as overflown,i have changed the following properties,
Set "Position" to "Float" 
Set "Stretch Type" to "Relative to the tallest object" 
Checked "Print when detail overflows" checkbox. 
But still no help.
my Jasper version is 4.5.0
Please assist.

Try Putting isPrintWhenDetailOverflows="true" inside every reportElement tag you are using. You have put this in only one of your tag.
Through this the element will be reprinted on the next page if the band does not fit in the current page.

Related

Jasper creating a bar chart for each series variable

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

How can I avoid "line breaking up" with line chart-JasperReport?

I am using Jaspersoft Studio version 6.3.0.final with JasperReports Library version 6.3.0 . I'm creating a Line chart with different series and category values. My question is that, when the graph is plotted, I observed that if for one category there are no values for a particular series, the line breaks and the line starts again from the next data point.
Is there anyway in which we can connect ALL the points in a particular series, so that it will be one continuous single line instead of broken lines and dots ?
I put an image as an example of what I get and I want to do and my .jrxml file for the line chart.
line chart example
<?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="chart_subreport" pageWidth="842" pageHeight="595" columnWidth="842" leftMargin="0" rightMargin="0" topMargin="10" bottomMargin="10">
<style name="table 1_TH" mode="Opaque" backcolor="#646464" forecolor="#FFFFFF" >
<box>
<pen lineColor="#969696" lineWidth="1.0"/>
</box>
</style>
<field name="TimePoints" class="java.util.Date"/>
<field name="LongAxis" class="java.lang.Double"/>
<field name="Lesion" class="java.lang.String"/>
<detail>
<band height="400" >
<printWhenExpression><![CDATA[$V{REPORT_COUNT}==1]]></printWhenExpression>
<lineChart>
<chart>
<reportElement style="table 1_TH" x="10" y="0" width="800" height="400"/>
<chartTitle>
<titleExpression><![CDATA["Lesion's evolution"]]></titleExpression>
</chartTitle>
</chart>
<categoryDataset>
<categorySeries>
<!-- This is the lesions you want to see on charts-->
<seriesExpression><![CDATA[$F{Lesion}]]></seriesExpression>
<!--You can change the format date here -->
<categoryExpression><![CDATA[(new SimpleDateFormat("MMM d, yyyy")).format($F{TimePoints})]]></categoryExpression>
<valueExpression><![CDATA[$F{LongAxis}]]></valueExpression>
</categorySeries>
</categoryDataset>
<linePlot isShowLines="true">
<plot backcolor="#323232" />
<categoryAxisFormat>
<axisFormat/>
</categoryAxisFormat>
<valueAxisFormat>
<axisFormat >
<labelFont>
<font fontName="Arial" size="10"/>
</labelFont>
</axisFormat>
</valueAxisFormat>
</linePlot>
</lineChart>
</band>
</detail>
</jasperReport>
I achieved to get what I want, I've just changed the type of the chart, now I'm using "timeSeriesChart".
<style name="table 1_TH" mode="Opaque" backcolor="#646464" forecolor="#FFFFFF" >
<box>
<pen lineColor="#969696" lineWidth="1.0"/>
</box>
</style>
<queryString>
<![CDATA[]]>
</queryString>
<field name="TimePoints" class="java.util.Date"/>
<field name="LongAxis" class="java.lang.Double"/>
<field name="Lesion" class="java.lang.String"/>
<field name ="nbInstance" class="java.lang.Integer"/>
<detail>
<band height="400" >
<printWhenExpression><![CDATA[$V{REPORT_COUNT}==$F{nbInstance}]]></printWhenExpression>
<timeSeriesChart>
<chart>
<reportElement style="table 1_TH" x="10" y="0" width="800" height="400"/>
<chartTitle>
<titleExpression><![CDATA["Lesion's evolution"]]></titleExpression>
</chartTitle>
</chart>
<timeSeriesDataset>
<timeSeries>
<seriesExpression><![CDATA[$F{Lesion}]]></seriesExpression>
<timePeriodExpression> <![CDATA[$F{TimePoints}]]></timePeriodExpression>
<valueExpression><![CDATA[$F{LongAxis}]]></valueExpression>
</timeSeries>
</timeSeriesDataset>
<timeSeriesPlot >
<plot backcolor="#323232" />
<timeAxisLabelExpression/>
<timeAxisFormat>
<axisFormat/>
</timeAxisFormat>
<valueAxisLabelExpression/>
<valueAxisFormat>
<axisFormat/>
</valueAxisFormat>
</timeSeriesPlot>
</timeSeriesChart>
</band>
</detail>

Jasper Report merging cells in jasper table results in unwanted coulmn

i am fairly new to jasper report. I need to merge cells in jasper table and i have managed some portion of it. See following image.
as u can see that the there is empty cells. I need a single cells instead of multiple empty cells. Can you guys help me with me. I am stuck. I am posting my jrxml
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report1" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="9c6d12ac-438a-4209-b92b-fe8357e9a0ab">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="2"/>
<style name="table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_CH" mode="Opaque" backcolor="#BFE1FF">
<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>
</style>
<subDataset name="medication" uuid="540773d1-98fb-48a3-9b89-a187c3e37e8a">
<queryString language="SQL">
<![CDATA[SELECT m.ID,m.medication_name,d.dose_time FROM medication m
LEFT JOIN dose_time d ON m.ID = d.medication_id;]]>
</queryString>
<field name="ID" class="java.lang.Integer">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="medication_name" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="dose_time" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<group name="ID">
<groupExpression><![CDATA[$F{ID}]]></groupExpression>
</group>
</subDataset>
<queryString>
<![CDATA[select mdt.ID,mdt.medication_name,dt.dose_time from medication mdt left join dose_time dt on mdt.ID = dt.medication_id;]]>
</queryString>
<field name="ID" class="java.lang.Integer">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="medication_name" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="dose_time" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<background>
<band splitType="Stretch"/>
</background>
<columnHeader>
<band height="61" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="125" splitType="Stretch">
<componentElement>
<reportElement uuid="b80b6480-79a3-4c7a-b7e6-73e8df552d6a" key="table" style="table" x="0" y="0" width="555" height="125">
<printWhenExpression><![CDATA[$V{REPORT_COUNT} == 1]]></printWhenExpression>
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="medication" uuid="966ad176-a042-4a9f-b4fe-3c5cf2c43370">
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
</datasetRun>
<jr:column width="90" uuid="1674ad29-29a8-47d3-9bf9-fb233d836dcc">
<jr:groupFooter groupName="ID">
<jr:cell height="0" rowSpan="1"/>
</jr:groupFooter>
<jr:columnHeader style="table_CH" height="32" rowSpan="1">
<staticText>
<reportElement uuid="1e2c5349-4cc9-4caf-9d7f-ac34dfbdb1b4" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[Medication Name]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell height="30" rowSpan="1">
<textField>
<reportElement uuid="cfeb2bce-6f8d-413c-8f4e-cfbe61cc2d24" style="table_TD" x="0" y="0" width="90" height="30">
<printWhenExpression><![CDATA[$V{ID_COUNT}==1]]></printWhenExpression>
</reportElement>
<box leftPadding="0">
<pen lineWidth="0.5"/>
<topPen lineWidth="0.5"/>
<leftPen lineWidth="0.5"/>
<bottomPen lineWidth="0.5"/>
<rightPen lineWidth="0.5"/>
</box>
<textElement/>
<textFieldExpression><![CDATA[$F{ID}+$F{medication_name}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90" uuid="193e3bc0-bdba-42ec-824a-cb0e7b37b7d1">
<jr:columnHeader style="table_CH" height="32" rowSpan="1">
<staticText>
<reportElement uuid="c165e681-8db2-49af-9046-e3db70bfe0cf" x="0" y="0" width="90" height="30"/>
<textElement/>
<text><![CDATA[Doses Time]]></text>
</staticText>
</jr:columnHeader>
<jr:detailCell style="table_TD" height="30" rowSpan="1">
<textField>
<reportElement uuid="78fff516-49ab-4e1d-aa06-4c97d48bad0d" x="0" y="0" width="90" height="30"/>
<textElement/>
<textFieldExpression><![CDATA[$F{dose_time}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</detail>
</jasperReport>
I see two possible solutions here:
Create a group band and group by "Medication Name" you will have empty cells but it will look cool :)
Use some SQL kung-fu with the function concat_ws() to get the "Doses Time" in the same field as a list.
Have fun and I hope it helps.

How do I show an empty table in iReport 3.0.0?

I'm modifying an existing iReport file, one that supposedly asks for an input from a program. The input is then placed in a table, which I assume, automatically adds rows as the data comes in.
However, the program isn't putting out the data, and is no longer required to do so. So now I only need an empty table to be displayed.
What I've done in iReport is to remove all traces of parameters (since they are no longer needed, and copy and paste all the cells until they reach the bottom of the page. Now none of the cells (except the header, and top row, because they have static text) are visible, and one of the reports even went as far as displaying a blank page.
I've tried setting the Report Properties: When No Data: to either No Data Section, or All Sections-No Detail, but it's still empty with no visible cells. I've also tried putting a space in the textfields, hoping that it would show, and even replacing them with rectangles (which worked in another report). However, nothing worked. The reports still show only the header.
How can I fix this? Thanks.
Here's the JRXML:
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Created with iReport - A designer for JasperReports -->
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport
name="ApprenticeEmployment1"
columnCount="1"
printOrder="Vertical"
orientation="Landscape"
pageWidth="1008"
pageHeight="612"
columnWidth="948"
columnSpacing="0"
leftMargin="30"
rightMargin="30"
topMargin="20"
bottomMargin="20"
whenNoDataType="AllSectionsNoDetail"
isTitleNewPage="false"
isSummaryNewPage="false">
<property name="ireport.scriptlethandling" value="0" />
<property name="ireport.encoding" value="UTF-8" />
<import value="java.util.*" />
<import value="net.sf.jasperreports.engine.*" />
<import value="net.sf.jasperreports.engine.data.*" />
<parameter name="imagedir" isForPrompting="false" class="java.lang.String"/>
<field name="REGION" class="java.lang.String"/>
<field name="PROVINCE" class="java.lang.String"/>
<field name="FULL_QUALIFICATION" class="java.lang.String"/>
<field name="DELIVERY" class="java.lang.String"/>
<field name="SECTOR" class="java.lang.String"/>
<field name="STUDENT_ID" class="java.lang.String"/>
<field name="LAST_NAME" class="java.lang.String"/>
<field name="FIRST_NAME" class="java.lang.String"/>
<field name="MI" class="java.lang.String"/>
<field name="CONTACT_NUMBER" class="java.lang.String"/>
<field name="E_MAIL" class="java.lang.String"/>
<field name="STREET" class="java.lang.String"/>
<field name="BARANGAY" class="java.lang.String"/>
<field name="CITY" class="java.lang.String"/>
<field name="SEX" class="java.lang.String"/>
<field name="DOB" class="java.lang.String"/>
<field name="AGE" class="java.math.BigDecimal"/>
<field name="CIVIL_STAT" class="java.lang.String"/>
<field name="EDUC_LEVEL" class="java.lang.String"/>
<field name="DATE_STARTED" class="java.lang.String"/>
<field name="DATE_FINISHED" class="java.lang.String"/>
<field name="REMARKS" class="java.lang.String"/>
<background>
<band height="0" isSplitAllowed="true" >
</band>
</background>
<title>
<band height="51" isSplitAllowed="true" >
<staticText>
<reportElement
x="0"
y="30"
width="948"
height="21"
key="staticText-1"/>
<box></box>
<textElement textAlignment="Center" verticalAlignment="Bottom">
<font pdfFontName="Helvetica-Bold" isBold="true"/>
</textElement>
<text><![CDATA[Apprentice Report Form]]></text>
</staticText>
<image hAlign="Center" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="238"
y="0"
width="470"
height="37"
key="image-1"/>
<box></box>
<graphicElement stretchType="NoStretch"/>
<imageExpression class="java.lang.String"><![CDATA[$P{imagedir}+"goldilocks-small.JPG"]]></imageExpression>
</image>
</band>
</title>
<pageHeader>
<band height="0" isSplitAllowed="true" >
</band>
</pageHeader>
<columnHeader>
<band height="65" isSplitAllowed="true" >
<staticText>
<reportElement
x="0"
y="18"
width="34"
height="31"
key="staticText-3"/>
<box> <topPen lineWidth="0.25"/>
<leftPen lineWidth="0.25"/>
<bottomPen lineWidth="0.25"/>
<rightPen lineWidth="0.25"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font/>
</textElement>
<text><![CDATA[Sex]]></text>
</staticText>
<staticText>
<reportElement
x="271"
y="18"
width="58"
height="31"
key="staticText-4"/>
<box> <topPen lineWidth="0.25"/>
<leftPen lineWidth="0.25"/>
<bottomPen lineWidth="0.25"/>
<rightPen lineWidth="0.25"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font/>
</textElement>
<text><![CDATA[Scholarship]]></text>
</staticText>
<staticText>
<reportElement
x="453"
y="18"
width="42"
height="31"
key="staticText-5"/>
<box> <topPen lineWidth="0.25"/>
<leftPen lineWidth="0.25"/>
<bottomPen lineWidth="0.25"/>
<rightPen lineWidth="0.25"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font/>
</textElement>
<text><![CDATA[Client Type
]]></text>
</staticText>
<staticText>
<reportElement
x="0"
y="1"
width="741"
height="17"
key="staticText-6"/>
</band>
</columnHeader>
<detail>
<band height="456" isSplitAllowed="true" >
<textField isStretchWithOverflow="true" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="0"
y="432"
width="34"
height="18"
key="textField-378"
stretchType="RelativeToTallestObject"
positionType="Float"/>
<textElement verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="0"
y="72"
width="34"
height="18"
key="textField-458"
stretchType="RelativeToTallestObject"
positionType="Float"/>
<textElement verticalAlignment="Middle">
<font size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="0" isSplitAllowed="true" >
</band>
</columnFooter>
<pageFooter>
<band height="0" isSplitAllowed="true" >
</band>
</pageFooter>
<summary>
<band height="0" isSplitAllowed="true" >
</band>
</summary>
</jasperReport>
I did edit out a lot of 'boxes' though, so if the format's wrong, that's me and not the JRXML itself.
Regards,
Zack_Falcon
To create a table with N empty records, even you don't have data.
create a object table
attach your DataSEt to this table or use an empty data source
select your table in the "Report inspector" and click right
select : "Edit table Datasource"
in the window you write: new net.sf.jasperreports.engine.JREmptyDataSource(44)
run your report
44 is the number to display empty records.
In the table properties, under table section select "ALL Section , No detail"
You can try this condition
$P{Parameter}==null ? "All" : $P{Parameter}
THis condition gives you All text if you don't select any input value.

iReport 4.1.3 table component never shows the first entry of the dataset

I have a probably simple problem when using ireport table component. I'm using XML as the datasource for the report.
The problem is that the table never shows the first entry of the dataset associated with it.
Imagine I have this data:
<name>
<first>adam 1</first>
<last>sand 1</last>
</name>
<name>
<first>adam 2</first>
<last>sand 2</last>
</name>
<name>
<first>adam 3</first>
<last>sand 3</last>
</name>
The output (table) will be (all data except the first row):
first last
adam 2 sand 2
adam 3 sand 3
The report template:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="consumption_in_zones_data" pageWidth="500" pageHeight="802" columnWidth="500" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="ireport.layers" value="##Tue Dec 06 12:01:43 GMT 2011\nlayer.0.name=Background\nlayer.0.visible=true\nlayer.0.id=0"/>
<style name="table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_CH" mode="Opaque" backcolor="#999999">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_TD" mode="Opaque" backcolor="#FFFFCC">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</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>
<subDataset name="table dataset">
<parameter name="ZoneID" class="java.lang.String"/>
<parameter name="PERIOD" class="java.lang.String"/>
<parameter name="UNIT" class="java.lang.String"/>
<queryString language="xPath">
<![CDATA[/OrganizationData/Building/Zone/Indicator/ActiveEnergy[ZoneID='$P{ZoneID}']]]>
</queryString>
<field name="time" class="java.lang.String">
<fieldDescription><![CDATA[time]]></fieldDescription>
</field>
<field name="consumption" class="java.lang.Double">
<fieldDescription><![CDATA[consumption]]></fieldDescription>
</field>
</subDataset>
<parameter name="ZoneID" class="java.lang.String"/>
<parameter name="PERIOD" class="java.lang.String"/>
<parameter name="UNIT" class="java.lang.String"/>
<queryString language="xPath">
<![CDATA[/OrganizationData/Building/Zone/Indicator/ActiveEnergy[ZoneID='$P{ZoneID}']]]>
</queryString>
<field name="time" class="java.lang.String">
<fieldDescription><![CDATA[time]]></fieldDescription>
</field>
<field name="consumption" class="java.lang.Double">
<fieldDescription><![CDATA[consumption]]></fieldDescription>
</field>
<variable name="consumption_1" class="java.lang.Double" resetType="Column" calculation="Sum">
<variableExpression><![CDATA[$F{consumption}]]></variableExpression>
</variable>
<variable name="consumption_2" class="java.lang.Double" resetType="Column" calculation="Sum">
<variableExpression><![CDATA[$F{consumption}]]></variableExpression>
</variable>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="197" splitType="Stretch">
<componentElement>
<reportElement key="table 1" style="table 1" x="0" y="0" width="500" height="197"/>
<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">
<datasetParameter name="ZoneID">
<datasetParameterExpression><![CDATA[$P{ZoneID}]]></datasetParameterExpression>
</datasetParameter>
<datasetParameter name="PERIOD">
<datasetParameterExpression><![CDATA[$P{PERIOD}]]></datasetParameterExpression>
</datasetParameter>
<datasetParameter name="UNIT">
<datasetParameterExpression><![CDATA[$P{UNIT}]]></datasetParameterExpression>
</datasetParameter>
<dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression>
</datasetRun>
<jr:column width="90">
<jr:tableHeader style="table 1_TH" height="30" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="90" height="30"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$P{PERIOD}]]></textFieldExpression>
</textField>
</jr:tableHeader>
<jr:detailCell style="table 1_TD" height="20" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="90" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{time}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90">
<jr:tableHeader style="table 1_TH" height="30" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="90" height="30"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$P{UNIT}]]></textFieldExpression>
</textField>
</jr:tableHeader>
<jr:detailCell style="table 1_TD" height="20" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="90" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{consumption}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</detail>
</jasperReport>
Data snippet:
<OrganizationData>
<Building>
<BuildingID>71721890-efd1-012c-c545-0a48cbee2b22</BuildingID>
<BuildingName>PT</BuildingName>
<Tariff>low</Tariff>
<Zone>
<ZoneID>bceba570-d0e2-012e-d950-7ac0bc5389eb</ZoneID>
<BuildingID>71721890-efd1-012c-c545-0a48cbee2b22</BuildingID>
<ZoneName>PT - Zone A</ZoneName>
<Type>ROUT</Type>
<Indicator>
<IndicatorID>96a41e20-60d8-012d-516c-5aacf9dbb012</IndicatorID>
<ZoneID>bceba570-d0e2-012e-d950-7ac0bc5389eb</ZoneID>
<BuildingID>71721890-efd1-012c-c545-0a48cbee2b22</BuildingID>
<IndicatorName>EA+ BlA P0</IndicatorName>
<ActiveEnergy>
<IndicatorID>96a41e20-60d8-012d-516c-5aacf9dbb012</IndicatorID>
<ZoneID>bceba570-d0e2-012e-d950-7ac0bc5389eb</ZoneID>
<BuildingID>71721890-efd1-012c-c545-0a48cbee2b22</BuildingID>
<time>01 Oct</time>
<consumption>0.1</consumption>
</ActiveEnergy>
<ActiveEnergy>
<IndicatorID>96a41e20-60d8-012d-516c-5aacf9dbb012</IndicatorID>
<ZoneID>bceba570-d0e2-012e-d950-7ac0bc5389eb</ZoneID>
<BuildingID>71721890-efd1-012c-c545-0a48cbee2b22</BuildingID>
<time>02 Oct</time>
<consumption>0.1</consumption>
</ActiveEnergy>
</Indicator>
</Zone>
</Building>
</OrganizationData>
thanks in advance,
Nuno
I've just check the table element with this test case.
My template:
<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="tablesample2" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<style name="table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<style name="table_TH" mode="Opaque" backcolor="#F0F8FF">
<box>
<pen lineWidth="0.5" lineColor="#000000"/>
</box>
</style>
<style name="table_CH" mode="Opaque" backcolor="#BFE1FF">
<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>
</style>
<subDataset name="Table Dataset 1">
<field name="city" class="java.lang.String"/>
<field name="id" class="java.lang.String"/>
</subDataset>
<queryString>
<![CDATA[]]>
</queryString>
<field name="city" class="java.lang.String"/>
<field name="id" class="java.lang.String"/>
<detail>
<band height="80" splitType="Stretch">
<componentElement>
<reportElement key="table" style="table" x="100" y="0" width="270" height="80"/>
<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 1">
<dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression>
</datasetRun>
<jr:column width="90">
<jr:detailCell style="table_TD" height="20" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{city}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90">
<jr:detailCell style="table_TD" height="20" rowSpan="1">
<textField>
<reportElement x="0" y="0" width="90" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$F{id}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="90">
<jr:detailCell style="table_TD" height="20" rowSpan="1"/>
</jr:column>
</jr:table>
</componentElement>
</band>
</detail>
</jasperReport>
My csv data file was:
"Dallas",47,"Janet Fuller","445 Upland Pl.","Trial"
"Lyon",38,"Andrew Heiniger","347 College Av.","Active"
"Dallas",43,"Susanne Smith","2 Upland Pl.","Active"
"Berne",22,"Bill Ott","250 - 20th Ave.","Active"
"Boston",32,"Michael Ott","339 College Av.","Trial"
"Dallas",4,"Sylvia Ringer","365 College Av.","Active"
"Boston",23,"Julia Heiniger","358 College Av.","Active"
"Chicago",39,"Mary Karsen","202 College Av.","Active"
"Dallas",40,"Susanne Miller","440 - 20th Ave.","Trial"
"Berne",9,"James Schneider","277 Seventh Av.","Active"
"Dallas",36,"John Steel","276 Upland Pl.","Suspended"
"Chicago",35,"George Karsen","412 College Av.","Suspended"
"Dallas",37,"Michael Clancy","19 Seventh Av.","Deleted"
"Lyon",2,"Anne Miller","20 Upland Pl.","Active"
"Dallas",0,"Laura Steel","429 Seventh Av.","Active"
"Lyon",28,"Susanne White","74 - 20th Ave.","Deleted"
"Paris",5,"Laura Miller","294 Seventh Av.","Active"
"Lyon",17,"Laura Ott","443 Seventh Av.","Active"
"New York",46,"Andrew May","172 Seventh Av.","Active"
"New York",44,"Sylvia Ott","361 College Av.","Active"
"Dallas",19,"Susanne Heiniger","86 - 20th Ave.","Active"
"Chicago",11,"Julia White","412 Upland Pl.","Active"
"Dallas",10,"Anne Fuller","135 Upland Pl.","Active"
"New York",41,"Bill King","546 College Av.","Deleted"
"Oslo",45,"Janet May","396 Seventh Av.","Active"
"Paris",18,"Sylvia Fuller","158 - 20th Ave.","Trial"
"San Francisco",48,"Robert White","549 Seventh Av.","Active"
"Paris",25,"Sylvia Steel","269 College Av.","Suspended"
"San Francisco",7,"James Peterson","231 Upland Pl.","Active"
"Oslo",42,"Robert Ott","503 Seventh Av.","Trial"
The first row from the data source was missed in the table.
I think this is issue related with iteration over the main datasource. You can read
Why is the first record missing from my subreport? post on community.jaspersoft.com.