i want to remove list component space when the data is null, i have tried (remove line when blank) option but there is no use, it is printing the space with height of list component.
thanks help is needed.
<?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="List" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="179e723d-ee8c-40bf-9ef6-914cef106c9a">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<subDataset name="dataset1" uuid="005448a6-5d6c-44c5-b063-7e85cdcd0cfe"/>
<subDataset name="dataset2" uuid="d8b4d679-e011-4828-adc5-cc0feeea6b44"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="79" splitType="Stretch"/>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="61" splitType="Stretch"/>
</columnHeader>
<detail>
<band height="125" splitType="Stretch">
<componentElement>
<reportElement x="5" y="13" width="797" height="88" uuid="d03a66cd-2364-4705-b9c1-7ccdc1f03542"/>
<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">
<datasetRun subDataset="dataset1" uuid="55af5621-ba24-4f19-8c1d-496627ce93c6">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource(1)]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="88" width="797">
<staticText>
<reportElement x="22" y="0" width="100" height="20" uuid="3a8c6a5e-2337-40b6-9464-984655b240c1"/>
<text><![CDATA[Parent List]]></text>
</staticText>
<staticText>
<reportElement x="186" y="0" width="100" height="20" uuid="3961e703-a32a-4c98-98fc-5b5fd745962a"/>
<text><![CDATA[Parent List]]></text>
</staticText>
<staticText>
<reportElement x="350" y="0" width="100" height="20" uuid="c75ef0b2-9d7b-4d53-89a9-60407300b1f5"/>
<text><![CDATA[Parent List]]></text>
</staticText>
<componentElement>
<reportElement x="0" y="20" width="797" height="26" uuid="3a0c69f8-788d-4e30-b9ab-3a5a7e6847b2"/>
<jr:list>
<datasetRun subDataset="dataset2" uuid="109058e7-c925-4ab2-ae35-4d71a8868623">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource(1)]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="26" width="797">
<staticText>
<reportElement x="20" y="4" width="100" height="20" uuid="528cdfee-2066-4c73-bfa4-01c71368e999"/>
<text><![CDATA[child List]]></text>
</staticText>
<staticText>
<reportElement x="190" y="4" width="100" height="20" uuid="3187542d-7f8d-4770-9d84-0a0a5ee2c841"/>
<text><![CDATA[Child List]]></text>
</staticText>
</jr:listContents>
</jr:list>
</componentElement>
<staticText>
<reportElement x="24" y="52" width="100" height="20" uuid="83d4dfff-8142-4e20-a929-e37a23ea2c20"/>
<text><![CDATA[Total]]></text>
</staticText>
</jr:listContents>
</jr:list>
</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>
Try having all the list components inside Frame component and enable isRemoveLineWhenBlank to rue to all the components including Frame component. Below is just a sample
<detail>
<band height="125" splitType="Stretch">
<frame>
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="124" y="114" width="393" height="17" isRemoveLineWhenBlank="true" isPrintWhenDetailOverflows="true" uuid="69f3030b-5ff6-4689-aa2f-d929dc017fc4"/>
<componentElement>
<reportElement x="5" y="13" width="797" height="88" uuid="d03a66cd-2364-4705-b9c1-7ccdc1f03542"/>
<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">
<datasetRun subDataset="dataset1" uuid="55af5621-ba24-4f19-8c1d-496627ce93c6">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource(1)]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="88" width="797">
<staticText>
<reportElement x="22" y="0" width="100" height="20" uuid="3a8c6a5e-2337-40b6-9464-984655b240c1"/>
<text><![CDATA[Parent List]]></text>
</staticText>
<staticText>
<reportElement x="186" y="0" width="100" height="20" uuid="3961e703-a32a-4c98-98fc-5b5fd745962a"/>
<text><![CDATA[Parent List]]></text>
</staticText>
<staticText>
<reportElement x="350" y="0" width="100" height="20" uuid="c75ef0b2-9d7b-4d53-89a9-60407300b1f5"/>
<text><![CDATA[Parent List]]></text>
</staticText>
<componentElement>
<reportElement x="0" y="20" width="797" height="26" uuid="3a0c69f8-788d-4e30-b9ab-3a5a7e6847b2"/>
<jr:list>
<datasetRun subDataset="dataset2" uuid="109058e7-c925-4ab2-ae35-4d71a8868623">
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource(1)]]></dataSourceExpression>
</datasetRun>
<jr:listContents height="26" width="797">
<staticText>
<reportElement x="20" y="4" width="100" height="20" uuid="528cdfee-2066-4c73-bfa4-01c71368e999"/>
<text><![CDATA[child List]]></text>
</staticText>
<staticText>
<reportElement x="190" y="4" width="100" height="20" uuid="3187542d-7f8d-4770-9d84-0a0a5ee2c841"/>
<text><![CDATA[Child List]]></text>
</staticText>
</jr:listContents>
</jr:list>
</componentElement>
<staticText>
<reportElement x="24" y="52" width="100" height="20" uuid="83d4dfff-8142-4e20-a929-e37a23ea2c20"/>
<text><![CDATA[Total]]></text>
</staticText>
</jr:listContents>
</jr:list>
</componentElement>
</frame>
</band>
</detail>
Hope this should help you out.
Related
I am trying to create a jasper report with a chart and data. But I am unable to display data in the second page. The header is also not displaying properly.
My report has the following elements/ bands :
1. A page header which shows a logo and from and to date fields
2. column header which has a graph/ chart
3. in the details band has data displayed using custom table structure (created with text fields).
4. and finally there is a page footer.
Please find the code below:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"
name="peopleAvg" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="1bb591b9-6043-4a15-b759-36bd5afbc1c2">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<parameter name="fromDate" class="java.lang.String"/>
<parameter name="toDate" class="java.lang.String"/>
<parameter name="orgLogo" class="java.io.InputStream"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="slno" class="java.lang.String"/>
<field name="hour" class="java.lang.String"/>
<field name="insideProductivity" class="java.lang.Double"/>
<field name="outsideProductivity" class="java.lang.Double"/>
<field name="day" class="java.lang.Double"/>
<field name="total" class="java.lang.Double"/>
<pageHeader>
<band height="66" splitType="Stretch">
<staticText>
<reportElement x="0" y="12" width="123" height="17" uuid="2ce05d01-f1ca-46ec-b055-6a786d6180a9"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[People Avg Productivity]]></text>
</staticText>
<staticText>
<reportElement x="0" y="42" width="52" height="21" uuid="1190e3e7-8e6e-4c07-a328-31ff29e54d3c"/>
<text><![CDATA[From Date:]]></text>
</staticText>
<textField>
<reportElement x="56" y="42" width="81" height="21" uuid="6dd52950-dbbb-48bd-8879-82cc00ad4f4c"/>
<textFieldExpression><![CDATA[$P{fromDate}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="138" y="42" width="47" height="21" uuid="ee86580c-820d-4116-94e5-eb5f745acf14"/>
<text><![CDATA[To Date:]]></text>
</staticText>
<textField>
<reportElement x="185" y="42" width="88" height="21" uuid="9d13a4d5-bddf-4bac-a44f-e24da7b38a0c"/>
<textFieldExpression><![CDATA[$P{toDate}]]></textFieldExpression>
</textField>
<image>
<reportElement x="480" y="0" width="70" height="59" uuid="a967b7a0-2bb3-41c9-a4a8-9597d26d4996"/>
<imageExpression><![CDATA[$P{orgLogo}]]></imageExpression>
</image>
<line>
<reportElement x="0" y="65" width="555" height="1" uuid="8af4ab23-161b-4419-ad6e-7056340a2023"/>
</line>
</band>
</pageHeader>
<columnHeader>
<band height="267" splitType="Stretch">
<stackedBar3DChart>
<chart evaluationTime="Report">
<reportElement x="0" y="9" width="555" height="210" uuid="8ff37812-d1a7-49ae-b62c-f10cb1a69a02">
<property name="com.jaspersoft.studio.unit.width" value="pixel"/>
</reportElement>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<categoryDataset>
<categorySeries>
<seriesExpression><![CDATA["Inside Mine"]]></seriesExpression>
<categoryExpression><![CDATA[$F{hour}]]></categoryExpression>
<valueExpression><![CDATA[$F{insideProductivity}]]></valueExpression>
<labelExpression><![CDATA[$F{insideProductivity}+""]]></labelExpression>
</categorySeries>
<categorySeries>
<seriesExpression><![CDATA["Outside Mine"]]></seriesExpression>
<categoryExpression><![CDATA[$F{hour}]]></categoryExpression>
<valueExpression><![CDATA[$F{outsideProductivity}]]></valueExpression>
<labelExpression><![CDATA[$F{outsideProductivity}+""]]></labelExpression>
</categorySeries>
</categoryDataset>
<bar3DPlot>
<plot labelRotation="66.0"/>
<itemLabel/>
<categoryAxisFormat labelRotation="66.0">
<axisFormat labelColor="#000000" tickLabelColor="#000000" axisLineColor="#000000"/>
</categoryAxisFormat>
<valueAxisFormat>
<axisFormat labelColor="#000000" tickLabelColor="#000000" axisLineColor="#000000"/>
</valueAxisFormat>
</bar3DPlot>
</stackedBar3DChart>
<staticText>
<reportElement x="97" y="228" width="58" height="30" uuid="dadece34-824f-481c-aa40-702eececcfa0"/>
<text><![CDATA[Time In Hrs]]></text>
</staticText>
<staticText>
<reportElement x="167" y="228" width="89" height="30" uuid="9f8ff91e-99d8-4fdd-98cb-4d6c09ac93f3"/>
<text><![CDATA[Mine In(Avg Time in Hrs)]]></text>
</staticText>
<staticText>
<reportElement x="267" y="228" width="100" height="30" uuid="fb564933-5603-440a-b4bb-9e7ffea3a60a"/>
<text><![CDATA[Mine Out(Avg Time In Hrs)]]></text>
</staticText>
<staticText>
<reportElement x="38" y="228" width="50" height="30" uuid="5c46f7d8-e33d-40ef-b266-be837cad3bf3"/>
<text><![CDATA[Sl.No]]></text>
</staticText>
<staticText>
<reportElement x="387" y="228" width="61" height="30" uuid="638b6be5-7679-45c9-a798-61e439710d14"/>
<text><![CDATA[Total Hours]]></text>
</staticText>
<staticText>
<reportElement x="137" y="187" width="73" height="30" uuid="94548637-903d-42b1-8be3-a59c9370fbf6"/>
<text><![CDATA[Time (in hrs)]]></text>
</staticText>
<staticText>
<reportElement x="2" y="60" width="18" height="65" uuid="01f4f72c-1f89-4dc9-a59f-bbc8e1523c0d"/>
<textElement rotation="Left"/>
<text><![CDATA[No of Hours]]></text>
</staticText>
<line>
<reportElement x="37" y="228" width="411" height="1" uuid="8097c975-2f0d-494e-a6b3-eac6c0049aea"/>
</line>
<line>
<reportElement x="38" y="227" width="1" height="38" uuid="967a9b95-64bc-4979-a11a-d12cb3204c27"/>
</line>
<line>
<reportElement x="448" y="227" width="1" height="39" uuid="22cfbc0d-5e9b-4853-a5c3-249210cbc611"/>
</line>
<line>
<reportElement x="88" y="226" width="1" height="39" uuid="d906ae7c-2395-4a03-9015-f38054af4239"/>
</line>
<line>
<reportElement x="162" y="228" width="1" height="37" uuid="2fcdb73a-f506-4425-8404-b12bbdf37759"/>
</line>
<line>
<reportElement x="263" y="228" width="1" height="37" uuid="a828608f-c02d-42d5-867b-6c4b41cc7ba3"/>
</line>
<line>
<reportElement x="380" y="227" width="1" height="39" uuid="a41cc5e7-d5ff-4ce1-aa45-110ce737febd"/>
</line>
</band>
</columnHeader>
<detail>
<band height="37" splitType="Stretch">
<textField pattern="" isBlankWhenNull="true">
<reportElement x="42" y="3" width="42" height="30" isPrintWhenDetailOverflows="true" uuid="4b14159d-88e2-403f-8d23-4348a9071edd"/>
<textFieldExpression><![CDATA[$F{slno}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="99" y="3" width="56" height="29" isPrintWhenDetailOverflows="true" uuid="c5f091cb-1dd4-42aa-b293-661fa30447d5"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{hour}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="166" y="4" width="90" height="30" isPrintWhenDetailOverflows="true" uuid="3e402bb8-2c7d-44d2-88f7-bfd3923fa79b"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{insideProductivity}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="266" y="5" width="100" height="30" isPrintWhenDetailOverflows="true" uuid="feb73c78-3f84-49ec-867b-aa4d0fa87aa6"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{outsideProductivity}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="386" y="5" width="60" height="30" isPrintWhenDetailOverflows="true" uuid="20a6c8ca-ce41-4ba1-a877-b84ec62401bf"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{total}]]></textFieldExpression>
</textField>
<line>
<reportElement x="38" y="-2" width="1" height="38" uuid="1dd9a050-2aee-4bf9-a05d-4191795c3b2c"/>
</line>
<line>
<reportElement x="88" y="-1" width="1" height="35" uuid="819297ed-658a-4e87-b2de-6de1c4ab0f9f"/>
</line>
<line>
<reportElement x="162" y="-1" width="1" height="35" uuid="683ef7c9-014a-4ece-8b8c-0f73238728fc"/>
</line>
<line>
<reportElement x="263" y="-3" width="1" height="40" uuid="1f47437f-6ee5-4281-aa7d-3d005ba8c3ba"/>
</line>
<line>
<reportElement x="380" y="0" width="1" height="37" uuid="c1d15bd7-3d55-4da6-8787-a6df37d0f892"/>
</line>
<line>
<reportElement x="448" y="-1" width="1" height="37" uuid="12959f57-ba8d-463f-9967-6c573a690dcf"/>
</line>
<line>
<reportElement x="39" y="35" width="410" height="1" uuid="5b39727f-2b4e-47d8-80c1-0b28afb08f72"/>
</line>
</band>
</detail>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
</jasperReport>
Please see the image below. At the bottom you will notice that the header printed is incomplete and also there is no more data in the page
Can some please help me here.
I could solve this problem. Actually there was a problem with the logo that I have used here. Due to this it was throwing an error. All I did was just change a couple of properties for the image and had to rerun the report. That is all. Sorry. And thank you.
I try to create a JasperReport's report with charts but getting error. I used table in the report and pie chart. Where I did wrong ?
I want to use same fields for reports and charts but I don't know how to use in both components.
Error:
Fields not found : campaignName
Fields not found : numTransmissions
<?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="template_Table" pageWidth="842" pageHeight="595" orientation="Landscape" whenNoDataType="NoPages" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<subDataset name="Dataset1">
<queryString>
<![CDATA[]]>
</queryString>
</subDataset>
<field name="campaignName" class="java.lang.String"/>
<field name="numTransmissions" class="java.lang.Integer"/>
<group name="Group1">
<groupExpression><![CDATA[(int)($V{REPORT_COUNT}/15)]]></groupExpression>
</group>
<group name="Group2">
<groupExpression><![CDATA[(int)($V{REPORT_COUNT}/5)]]></groupExpression>
</group>
<detail>
<band height="449" splitType="Stretch">
<componentElement>
<reportElement stretchType="RelativeToTallestObject" mode="Transparent" x="0" y="0" width="800" height="199" forecolor="#FFFFFF" backcolor="#424242">
</reportElement>
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
<datasetRun subDataset="Dataset1"/>
<jr:column width="52">
<jr:tableHeader height="70">
<staticText>
<reportElement x="0" y="0" width="52" height="70"/>
<box leftPadding="3"/>
<textElement textAlignment="Left" verticalAlignment="Middle" markup="html">
<font fontName="Verdana" size="9"/>
</textElement>
<text><![CDATA[Campaign Name]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell height="50">
<textField>
<reportElement x="0" y="0" width="52" height="50"/>
<box leftPadding="6"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font fontName="Verdana"/>
</textElement>
<textFieldExpression><![CDATA[$F{campaignName}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
<jr:column width="53">
<jr:tableHeader height="70">
<staticText>
<reportElement x="0" y="0" width="53" height="70"/>
<box leftPadding="3"/>
<textElement textAlignment="Left" verticalAlignment="Middle" markup="html">
<font fontName="Verdana" size="9"/>
</textElement>
<text><![CDATA[Email Transmissions]]></text>
</staticText>
</jr:tableHeader>
<jr:detailCell height="50">
<textField>
<reportElement x="0" y="0" width="53" height="50"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{numTransmissions}]]></textFieldExpression>
</textField>
</jr:detailCell>
</jr:column>
</jr:table>
</componentElement>
</band>
</detail>
<summary>
<band height="400" splitType="Stretch">
<pieChart>
<chart evaluationTime="Report">
<reportElement x="135" y="0" width="270" height="300"/>
<chartTitle>
<titleExpression><![CDATA["My First JR Pie Chart"]]></titleExpression>
</chartTitle>
<chartSubtitle/>
<chartLegend/>
</chart>
<pieDataset>
<keyExpression><![CDATA[$F{campaignName}]]></keyExpression>
<valueExpression><![CDATA[$F{numTransmissions}]]></valueExpression>
</pieDataset>
<piePlot>
<plot/>
<itemLabel/>
</piePlot>
</pieChart>
</band>
</summary>
</jasperReport>
I am creating a jasper report showing some person names. I need to show the number of persons in the list at the bottom.
The problem I am facing is I am getting a small gap between persons list and the label "Total Candidates".
For the reference, please check below image:
In the beginning, column footer was getting shown at the end of page, leaving a lot of gap. Then I found few good StackOverflow links:
1) Issue with Column footer and Summary bands
2) Jasper Reports - how to get column footer to appear directly below details band
which suggested to set "Float Column Footer" to true. After doing that, the gap reduced and my column footer is almost below the detail band. But still, as shown in the picture, there is some gap remaining, which I don't know how to remove.
Edit: Here is my jrxml file:
<?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" isFloatColumnFooter="true" uuid="b7718df8-d1d7-46e7-9a66-7d3fe24c720c">
<parameter name="ReportName" class="java.lang.String"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="firstName" class="java.lang.String">
<fieldDescription><![CDATA[firstName]]></fieldDescription>
</field>
<field name="id" class="java.lang.String">
<fieldDescription><![CDATA[id]]></fieldDescription>
</field>
<field name="lastName" class="java.lang.String">
<fieldDescription><![CDATA[lastName]]></fieldDescription>
</field>
<field name="middleName" class="java.lang.String">
<fieldDescription><![CDATA[middleName]]></fieldDescription>
</field>
<title>
<band height="42" splitType="Stretch">
<textField>
<reportElement x="0" y="0" width="555" height="42" uuid="b6eaae95-75f5-4b33-978b-8afd7f9ecfee"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="20"/>
</textElement>
<textFieldExpression><![CDATA[$P{ReportName}]]></textFieldExpression>
</textField>
</band>
</title>
<columnHeader>
<band height="20" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="32" height="20" uuid="3dfe1b88-b77c-465e-bc1d-d96223c69692"/>
<text><![CDATA[Sr. No.]]></text>
</staticText>
<staticText>
<reportElement x="32" y="0" width="188" height="20" uuid="96add808-7f90-405d-93fc-ae64596df9e3"/>
<textElement textAlignment="Center"/>
<text><![CDATA[First Name]]></text>
</staticText>
<staticText>
<reportElement x="220" y="0" width="188" height="20" uuid="dd5aa422-a23c-4a4c-a464-9e927503c342"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Middle Name]]></text>
</staticText>
<staticText>
<reportElement x="408" y="0" width="147" height="20" uuid="e7894574-4f95-4a04-b54b-16f636dc453c"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Last Name]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="20" splitType="Stretch">
<textField>
<reportElement x="0" y="0" width="32" height="20" uuid="b0a9a50f-f275-4802-ba80-04559e57c75e"/>
<textFieldExpression><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="32" y="0" width="188" height="20" uuid="4ea4f73b-06bb-4553-848b-eecdc6be51b2"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{firstName}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="220" y="0" width="188" height="20" uuid="d2ea4610-7ee7-4921-babe-6d9040592843"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{middleName}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="408" y="0" width="147" height="20" uuid="045272ac-1387-49c6-a4e1-237725e08269"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{lastName}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="20" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="79" height="20" uuid="5a71d074-89c3-4b70-ae90-840cb37b45e8"/>
<text><![CDATA[Total Candidates:]]></text>
</staticText>
</band>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
Any suggestions would be really appreciated!
<summary>
<band height="0" splitType="Stretch"/>
</summary>
or remove the tag completely.
I am using Jaspersoft Studio to create a JasperReports's report using an Excel file as data source (I have a couple of columns in excel with numeric values to which i have assigned the class java.lang.Number in fields). But when previewing the report, I get the following the error
"net.sf.jasperreports.engine.JRException: unable to get value for field 'Hours' of class java.lang.Number"
Any inputs please?
Here is my jrxml file
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 5.6.1.final using JasperReports Library version 5.6.1 -->
<!-- 2014-09-25T18:35:44 -->
<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="Leaf_Grey" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="896e484a-2240-4304-afcc-7290c150d8b7">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="New Data Adapter (4)"/>
<style name="Title" fontName="Arial" fontSize="26" isBold="true" pdfFontName="Helvetica-Bold"/>
<style name="SubTitle" forecolor="#666666" fontName="Arial" fontSize="18"/>
<style name="Column header" forecolor="#666666" fontName="Arial" fontSize="12" isBold="true"/>
<style name="Detail" fontName="Arial" fontSize="12"/>
<queryString>
<![CDATA[]]>
</queryString>
<field name="Task" class="java.lang.String"/>
<field name="Site Name" class="java.lang.String"/>
<field name="Hours" class="java.lang.Number"/>
<field name="Minutes" class="java.lang.Number"/>
<field name="Status" class="java.lang.String"/>
<field name="Comments" class="java.lang.String"/>
<field name="Employee Name" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="70" splitType="Stretch">
<image>
<reportElement x="275" y="0" width="300" height="64" uuid="8636fef6-bee7-4ac4-9942-653e5c68326b"/>
<imageExpression><![CDATA["leaf_banner_gray.png"]]></imageExpression>
</image>
<staticText>
<reportElement style="Title" x="0" y="13" width="263" height="33" uuid="4370ee46-32ee-4993-8fc6-fff1a5cbbb10"/>
<textElement verticalAlignment="Middle"/>
<text><![CDATA[Leaf Gray Title]]></text>
</staticText>
<staticText>
<reportElement style="SubTitle" x="117" y="46" width="157" height="22" uuid="e0a627c7-e8b9-4efb-8e25-85fea9d9be9c"/>
<text><![CDATA[Leaf Gray SubTitle]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="36" splitType="Stretch">
<line>
<reportElement positionType="FixRelativeToBottom" x="0" y="35" width="555" height="1" uuid="8545dbd1-d876-4d96-8abf-d6b221e00a45"/>
<graphicElement>
<pen lineWidth="0.5" lineColor="#999999"/>
</graphicElement>
</line>
<staticText>
<reportElement style="Column header" x="0" y="19" width="79" height="15" uuid="cac2a980-c74e-44b0-b596-05d495272ccb"/>
<text><![CDATA[Task]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="79" y="19" width="79" height="15" uuid="d55bebe9-d167-4528-a78c-a5a41af89efc"/>
<text><![CDATA[Site Name]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="158" y="19" width="79" height="15" uuid="667ce640-c671-4337-8f0c-d23b3f4b273c"/>
<text><![CDATA[Hours]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="237" y="19" width="79" height="15" uuid="df472e1f-39fb-4b34-b0b3-0867407df860"/>
<text><![CDATA[Minutes]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="316" y="19" width="79" height="15" uuid="05e27ddd-a03c-4ad6-8596-5cfc00655de7"/>
<text><![CDATA[Status]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="395" y="19" width="79" height="15" uuid="cefa7fbe-75bd-4923-82a6-da21a13d4f58"/>
<text><![CDATA[Comments]]></text>
</staticText>
<staticText>
<reportElement style="Column header" x="474" y="19" width="79" height="15" uuid="090b77e6-6a38-43b4-8501-6e1c3e246764"/>
<text><![CDATA[Employee Name]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="16" splitType="Stretch">
<line>
<reportElement positionType="FixRelativeToBottom" x="0" y="15" width="555" height="1" uuid="9b18ea63-f82d-4ef1-872e-8fde09656872"/>
<graphicElement>
<pen lineWidth="0.5" lineColor="#999999"/>
</graphicElement>
</line>
<textField>
<reportElement style="Detail" x="0" y="0" width="79" height="15" uuid="1f24eaab-1923-419e-9262-79b6c2b80499"/>
<textFieldExpression><![CDATA[$F{Task}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="Detail" x="79" y="0" width="79" height="15" uuid="f9b21e3a-3150-4744-a413-10cf734a2c3d"/>
<textFieldExpression><![CDATA[$F{Site Name}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="Detail" x="158" y="0" width="79" height="15" uuid="867d0368-9589-4c6b-8502-f71224a11a4c"/>
<textFieldExpression><![CDATA[$F{Hours}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="Detail" x="237" y="0" width="79" height="15" uuid="17715223-dbc6-462a-b80c-aeb54aa58932"/>
<textFieldExpression><![CDATA[$F{Minutes}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="Detail" x="316" y="0" width="79" height="15" uuid="3a3115d3-420d-4411-88cc-30b41f67443e"/>
<textFieldExpression><![CDATA[$F{Status}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="Detail" x="395" y="0" width="79" height="15" uuid="97194b34-07e1-49b4-aba0-af1efe7b9bf4"/>
<textFieldExpression><![CDATA[$F{Comments}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="Detail" x="474" y="0" width="79" height="15" uuid="ba21b35b-74a9-45ee-862f-8752756350dd"/>
<textFieldExpression><![CDATA[$F{Employee Name}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch">
<line>
<reportElement positionType="FixRelativeToBottom" x="0" y="3" width="555" height="1" uuid="7d65af8c-8abe-40ae-9953-98342530289f"/>
<graphicElement>
<pen lineWidth="0.5" lineColor="#999999"/>
</graphicElement>
</line>
</band>
</columnFooter>
<pageFooter>
<band height="20" splitType="Stretch">
<textField>
<reportElement style="Column header" x="433" y="0" width="80" height="20" uuid="afe06d42-bf57-40c1-9cbb-6e8a04a641e6"/>
<textElement textAlignment="Right">
<font size="10" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement style="Column header" x="513" y="0" width="40" height="20" uuid="ee38e653-d5c9-4269-93a3-b1dcd2685d2c"/>
<textElement>
<font size="10" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField pattern="EEEEE dd MMMMM yyyy">
<reportElement style="Column header" x="0" y="0" width="197" height="20" uuid="af6b71ba-3c04-4b3c-9b70-e18e46b27ff4"/>
<textElement>
<font size="10" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band splitType="Stretch"/>
</summary>
</jasperReport>
And a sample excel file as follows:
Task Site Name Hours Minutes Status Comments Employee Name
Task A abc.com 3 45 Ongoing Easy Jim
Task B abc.com 1 20 Done Easy John
Task C abc.com 3 30 Ongoing Easy Jim
Task A abc.com 1 20 Done Easy John
Task D abc.com 3 45 Ongoing Easy Mary
Task A abc.com 1 20 Done Easy Stacy
Task E abc.com 3 30 Ongoing Easy Stacy
Task A abc.com 1 20 Done Easy Stacy
1) If the requirement is to change the Class to Number from String then, you need to click the checkbox "Use custom number pattern" and select a number pattern.
2) If there is no specific requirement, then its easy to select java.lang.Integer as the class for numbers. This will make the report work just fine.
I need to create subreports in detail band, i am passing same datasource of main report to subreports.
Issue i am facing as it goes in to subreport it increments the index counter which does not allow to add remaining subreport.
MainReport.jrxml
<group name="Account Summary">
<groupHeader>
<band height="100" splitType="Stretch">
<printWhenExpression><![CDATA[$F{accountSummary.hasRepots}]]></printWhenExpression>
<subreport isUsingCache="false">
<reportElement x="28" y="0" width="540" height="100" isRemoveLineWhenBlank="true"/>
<subreportParameter name="accountSummary">
<subreportParameterExpression><![CDATA[$F{accountSummary.hasRepots}]]></subreportParameterExpression>
</subreportParameter>
<dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "SubReport.jasper"]]></subreportExpression>
</subreport>
</band>
</groupHeader>
</group>
SubReport.jrxml
<detail>
<band height="100" splitType="Stretch">
<subreport isUsingCache="false">
<reportElement positionType="Float" x="0" y="0" width="540" height="100" isRemoveLineWhenBlank="true"/>
<dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + $F{subreportFileName}]]></subreportExpression>
</subreport>
</band>
</detail>
Where i pass $F{subreportFileName} from my datasource for example "SubSubReport.jrxml", but it only displays first report, i guess due to my index counter runs out in my sub-sub report so my sub report detail band doesn't go for each element.
SubSubReport.jrxml
<field name="chartData.label" class="java.lang.String"/>
<field name="chartData.value" class="java.lang.Float"/>
<field name="value1" class="java.lang.String"/>
<field name="value2" class="java.lang.String"/>
<field name="value3" class="java.lang.String"/>
<pageHeader>
<band height="114" splitType="Stretch">
<staticText>
<reportElement style="lbl-light-golden" x="12" y="19" width="170" height="67"/>
<textElement>
<font size="26"/>
</textElement>
<text><![CDATA[Some Label]]></text>
</staticText>
<pieChart>
<chart evaluationTime="Band">
<reportElement x="272" y="0" width="268" height="114"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend position="Left"/>
</chart>
<pieDataset>
<keyExpression><![CDATA[$F{chartData.label}]]></keyExpression>
<valueExpression><![CDATA[$F{chartData.value}]]></valueExpression>
<labelExpression><![CDATA[null]]></labelExpression>
</pieDataset>
<piePlot isShowLabels="false" isCircular="true">
<plot/>
<itemLabel/>
</piePlot>
</pieChart>
</band>
</pageHeader>
<columnHeader>
<band height="18" splitType="Stretch">
<line>
<reportElement x="0" y="1" width="540" height="1"/>
</line>
<staticText>
<reportElement style="lbl-black-table-header" x="12" y="4" width="158" height="14"/>
<textElement/>
<text><![CDATA[Header 1]]></text>
</staticText>
<staticText>
<reportElement style="lbl-black-table-header" x="205" y="4" width="199" height="14"/>
<textElement textAlignment="Right"/>
<text><![CDATA[Header 2]]></text>
</staticText>
<staticText>
<reportElement style="lbl-black-table-header" x="445" y="4" width="74" height="13"/>
<textElement textAlignment="Center"/>
<text><![CDATA[Header 3]]></text>
</staticText>
<line>
<reportElement x="0" y="17" width="540" height="1"/>
</line>
</band>
</columnHeader>
<detail>
<band height="18" splitType="Stretch">
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" x="12" y="1" width="158" height="16"/>
<textElement/>
<textFieldExpression><![CDATA[$F{value1}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" x="205" y="1" width="199" height="16"/>
<textElement textAlignment="Right">
<font isStrikeThrough="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{value2}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement positionType="Float" x="445" y="1" width="74" height="16"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA[$F{value3}]]></textFieldExpression>
</textField>
</band>
</detail>
Also i tried using Groups instead of detail band as follows in "SubReport.jrxml"
SubReport.jrxml
<group name="Sub report 1">
<groupHeader>
<band height="100" splitType="Stretch">
<subreport isUsingCache="false">
<reportElement positionType="Float" x="0" y="0" width="540" height="100" isRemoveLineWhenBlank="true"/>
<dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "SubSubReport.jasper"]]></subreportExpression>
</subreport>
</band>
</groupHeader>
</group>
<group name="Sub report 2">
<groupHeader>
<band height="200" splitType="Stretch">
<staticText>
<reportElement x="110" y="10" width="100" height="20"/>
<textElement/>
<text><![CDATA[Sub report 2]]></text>
</staticText>
<subreport isUsingCache="false">
<reportElement positionType="Float" x="0" y="40" width="540" height="100" isRemoveLineWhenBlank="true"/>
<dataSourceExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "SubSubReport1.jasper"]]></subreportExpression>
</subreport>
</band>
</groupHeader>
</group>
It prints "Sub report 2" label but no success with printing "SubSubReport1.jasper"
What am i doing wrong any suggestions or any direction which can help.
the report data source should never be used to feed a subreport. The REPORT_DATA_SOURCE is a data source that is a consumable object.
This means that is usable for feeding a report only once. Therefore, the parameter technique is not suitable when every record of the master report has its own subreport (unless there is only one record in the master report). I think this could be the reason that you see only one.