How to add empty max row in Jasper report? - jasper-reports

I want to add empty records after the end of rows. I am trying to fixing rows per page.
Without data I need blank lines in my jasper report. Is it possible?
This is my source code:
<detail>
<band height="24">
<line>
<reportElement x="1" y="22" width="801" height="1" uuid="dc8cb0ba-10e2-4fe4-be84-9b6f71e94fea"/>
</line>
<line>
<reportElement x="0" y="-1" width="1" height="24" uuid="1946ddf4-1087-43a7-91c7-774237d8cb19"/>
</line>
<line>
<reportElement x="60" y="-1" width="1" height="24" uuid="ac4afafc-2517-4355-9e42-065079e6349f"/>
</line>
<line>
<reportElement x="120" y="-1" width="1" height="24" uuid="51901938-647b-48ab-a23c-9f46cc7af0a1"/>
</line>
<line>
<reportElement x="361" y="-2" width="1" height="24" uuid="0cefe047-9c23-4bf3-8596-b96000f24a87"/>
</line>
<line>
<reportElement x="495" y="-1" width="1" height="24" uuid="92b2c4c7-0871-4b55-be28-b45598906c9b"/>
</line>
<line>
<reportElement x="187" y="-1" width="1" height="23" uuid="a76d5a9d-08a7-42f8-9931-2afc1f085e62"/>
</line>

try with this,
use the background band to add empty records after the end of rows
<background>
<band height="307" splitType="Stretch">
<line>
<reportElement x="0" y="145" width="555" height="1" uuid="8184649e-10af-49b8-9f36-9df1020a2371"/>
</line>
<!-- add the suitable amount of lines -->
</background>
example for this solution (jrxml file)
<jasperReport xmlns=".....">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
<queryString>
<![CDATA[]]>
</queryString>
<background>
<band height="328" splitType="Stretch">
<line>
<reportElement x="0" y="169" width="555" height="1" uuid="8184649e-10af-49b8-9f36-9df1020a2371"/>
</line>
<line>
<reportElement x="0" y="199" width="555" height="1" uuid="86060b38-40cc-4963-be7d-21df01a8aaa1"/>
</line>
<line>
<reportElement x="0" y="229" width="555" height="1" uuid="a531a915-b5cf-4854-9eb6-2981768b4db3"/>
</line>
<line>
<reportElement x="0" y="259" width="555" height="1" uuid="edb3bab2-0562-4e82-bbd0-763508148054"/>
</line>
<line>
<reportElement x="0" y="289" width="555" height="1" uuid="e0826eaa-7846-495f-9096-b07733283f9b"/>
</line>
<line>
<reportElement x="0" y="319" width="555" height="1" uuid="6b199ad4-87aa-4d47-9751-46a3e277b919"/>
</line>
</band>
</background>
<title>
<band height="79" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="555" height="30" uuid="496a564f-23a2-41eb-9e55-8faf2ba6b7dd"/>
<textElement textAlignment="Center">
<font size="20"/>
</textElement>
<text><![CDATA[Title]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="35" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="555" height="30" uuid="f3677b34-d2e8-45db-923f-76dc120624b6"/>
<textElement textAlignment="Center">
<font size="20"/>
</textElement>
<text><![CDATA[Page Header]]></text>
</staticText>
</band>
</pageHeader>
<columnHeader>
<band height="31" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="555" height="30" uuid="439da16b-0dc3-4e1e-a367-dcf66405a5d3"/>
<textElement textAlignment="Center">
<font size="20"/>
</textElement>
<text><![CDATA[Table Header]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="24" splitType="Stretch">
<textField>
<reportElement x="0" y="0" width="555" height="24" uuid="96bc78b4-7796-4b6b-9ed8-d13abd506522"/>
<textElement textAlignment="Center">
<font size="18"/>
</textElement>
<textFieldExpression><![CDATA["Data in detail band"]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
preview of above jrxml file

Related

Issue with showing data in the second page of report

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.

Resetting page number based on grouping

I wonder if it is possible to reset page number based on grouping?
My idea is like group 1 having 3 pages which will show Page 1 of 3, page 2 of 3 and page 3 of 3. And group 2 having 1 page which will show Page 1 of 1.
So the display will be:
Page 1 of 3
Page 2 of 3
Page 3 of 3
page 1 of 1
Is it possible to do that? I have searched all the web seems like can't find any clue and steps to do.
Source
<queryString language="SQL">
<![CDATA[Select * from Persons where ID = $P{ID}]]>
</queryString>
<field name="ID" class="java.lang.Object"/>
<group name="myGroup" isStartNewPage="true" isResetPageNumber="true">
<groupHeader>
<band height="224">
<subreport>
<reportElement x="300" y="135" width="270" height="60" uuid="1f20858d-c055-41e2-9a60-bbc040ae6485"/>
<subreportParameter name="ID_PERSON">
<subreportParameterExpression><![CDATA[$F{ID}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["subreport_1.jasper"]]></subreportExpression>
</subreport>
<staticText>
<reportElement x="280" y="10" width="100" height="30" uuid="dacdfcd9-150b-419d-ba3b-b56949cd518d"/>
<text><![CDATA[Group 1]]></text>
</staticText>
<break>
<reportElement x="0" y="210" width="99" height="1" uuid="a77bf8e0-98ea-4167-b852-f2cb5f6e1cf6"/>
</break>
<staticText>
<reportElement x="280" y="58" width="300" height="30" uuid="df9536c9-6584-43b3-b8b9-45fd0c0b95a6"/>
<text><![CDATA[This report is to testing the grouping.]]></text>
</staticText>
<break>
<reportElement x="0" y="111" width="100" height="1" uuid="6cda26ee-6e49-4e94-8d58-5d5dd42745e6"/>
</break>
</band>
</groupHeader>
<groupFooter>
<band height="50"/>
</groupFooter>
</group>
<group name="myGroup2" isStartNewPage="true" isResetPageNumber="true">
<groupHeader>
<band height="130">
<subreport>
<reportElement x="270" y="60" width="300" height="60" uuid="5663a0dc-9b14-485b-84a9-21b5e0c3b98d"/>
<subreportParameter name="ID_PERSON">
<subreportParameterExpression><![CDATA[$F{ID}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["subreport_2.jasper"]]></subreportExpression>
</subreport>
<staticText>
<reportElement x="280" y="20" width="100" height="30" uuid="eaa5ee0f-c0e5-4555-b321-a4db52b4efde"/>
<text><![CDATA[Group 2]]></text>
</staticText>
</band>
</groupHeader>
<groupFooter>
<band height="58"/>
</groupFooter>
</group>
<pageFooter>
<band height="57" splitType="Stretch">
<textField evaluationTime="Group" evaluationGroup="myGroup">
<reportElement x="400" y="10" width="100" height="30" uuid="215676d9-e972-45bd-adad-b79c1fa27112"/>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="310" y="10" width="110" height="30" uuid="75a82ec2-a8ed-46dd-b5a1-147c450e32f8"/>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>

Remove space of list component in jasper ireport

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.

Trying to get Jaspersoft Studio to Read Excel Numeric Values

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.

Jasper server subreport in detail band

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.