Stretch with overflow Detail band not working as expected - jasper-reports

I have a simple report. It has two bands title and detail.
In the Title I have a static text, in the Detail I have one textField.
The textField is set to stretchwithoverflow = "true". If I set the height for this field to fit one raw information, I get for the larger information one and a half rows. So one textField, in the textField I have 2 rows information, first row displayed correctly, second one - I can see a half height.
Can this be done? Expand only the rows that contain larger information and the larger information will fit well in the text field?
<?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="report7" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="15f9d2dd-21ce-41ec-bcb8-c1aca3a77e37">
<parameter name="EndDate" class="java.util.Date">
<defaultValueExpression><![CDATA[new java.util.Date()]]></defaultValueExpression>
</parameter>
<parameter name="Project" class="java.util.Collection"/>
<parameter name="Severity" class="java.util.Collection"/>
<parameter name="StartDate" class="java.util.Date">
<defaultValueExpression><![CDATA[new java.util.Date(112, 0, 01)]]></defaultValueExpression>
</parameter>
<parameter name="Project_Sets" class="java.util.Collection"/>
<queryString>
<![CDATA[some query]]>
</queryString>
<field name="crid" class="java.lang.String"/>
<field name="SEVER" class="java.lang.String"/>
<field name="product" class="java.lang.String"/>
<field name="state" class="java.lang.String"/>
<field name="status" class="java.lang.String"/>
<field name="submit_date" class="java.lang.String"/>
<field name="aging" class="java.lang.Long"/>
<title>
<band height="25" splitType="Stretch">
<staticText>
<reportElement uuid="63eef93a-7e8f-4c69-b9d6-4447fe90673d" x="0" y="0" width="555" height="25" forecolor="#3399FF"/>
<textElement textAlignment="Center">
<font size="16" isBold="true"/>
</textElement>
<text><![CDATA[Defects Aging]]></text>
</staticText>
</band>
</title>
<columnHeader>
<band height="32">
<rectangle>
<reportElement uuid="9a2288d4-87ce-4ee7-b04e-267a7ee0ea8b" x="0" y="0" width="555" height="32" backcolor="#99CC00"/>
</rectangle>
<staticText>
<reportElement uuid="9281aa7a-4bcc-4456-9f25-83c7b2360a01" x="0" y="0" width="79" height="32" forecolor="#FFFFFF"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<text><![CDATA[CRID]]></text>
</staticText>
<staticText>
<reportElement uuid="cacda134-069c-43ae-abc1-76f5c865df41" x="79" y="0" width="79" height="32" forecolor="#FFFFFF"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Severity]]></text>
</staticText>
<staticText>
<reportElement uuid="d798786f-5ee0-4e76-8a35-2f908af6e92c" positionType="Float" x="158" y="0" width="79" height="32" forecolor="#FFFFFF"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Product]]></text>
</staticText>
<staticText>
<reportElement uuid="6be4792d-01a5-4d18-940d-90f40417c7ad" positionType="Float" x="237" y="0" width="79" height="32" forecolor="#FFFFFF"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<text><![CDATA[State]]></text>
</staticText>
<staticText>
<reportElement uuid="fa447ca9-121c-43fb-a7bf-1b29ada93adf" positionType="Float" x="316" y="0" width="79" height="32" forecolor="#FFFFFF"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Status]]></text>
</staticText>
<staticText>
<reportElement uuid="b2d8f1db-871b-4e34-942f-b8c4a87a358b" positionType="Float" x="395" y="0" width="79" height="32" forecolor="#FFFFFF"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Submit Date]]></text>
</staticText>
<staticText>
<reportElement uuid="c3eddc7c-25ca-4e29-a01e-13e856b67d03" x="474" y="0" width="79" height="32" forecolor="#FFFFFF"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Arial" size="12" isBold="true"/>
</textElement>
<text><![CDATA[Days]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="81" splitType="Stretch">
<elementGroup>
<textField isStretchWithOverflow="true">
<reportElement uuid="6422c6d3-40b9-4e38-8bb4-ded91c91ac17" stretchType="RelativeToBandHeight" x="158" y="0" width="79" height="39"/>
<textElement textAlignment="Left" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{product}]]></textFieldExpression>
</textField>
</elementGroup>
</band>
</detail>
</jasperReport>

In the same band if there are more items and you want to have all same stretched. It has to be set to all of them to stretchType="RelativeToTallestObject" and isStretchWithOverflow="true".
<textField isStretchWithOverflow="true" pattern="###0">
<reportElement stretchType="RelativeToTallestObject" x="1576" y="0" width="91" height="20"/>
<textElement textAlignment="Center"/>
<textFieldExpression class="java.lang.Long"><![CDATA[$F{count_tohfa}]]></textFieldExpression>
</textField>

Report property: Add this
net.sf.jasperreports.text.save.line = true
net.sf.jasperreports.export.html.wrap.break.word = true
Source: Word Wrapping HTML versus PDF

Related

Jasper Report Gouping doesnt work for subreport data

I have a MAIN report and then a subreport that it is given the data from the MAIN report like this:
<subreport>
<reportElement x="0" y="0" width="555" height="224" uuid="b72a4572-ac0d-4a54-b57e-86e0420d1d94"/>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{sortedPositions})]]></dataSourceExpression>
<subreportExpression><![CDATA["/storage/intranet/balancing/templates/INVOICE_POSITIONS_PICASSO_TEMPLATE.jasper"]]></subreportExpression>
</subreport>
sortedPositions has the following fields
id
quantity
value
description
corridor
ProductConfiguration productConfiguration (another class)
When i try to group by any of the sortedPositions fileds the grouping doesn't work.
When i tried to book from the productConfiguration.field the grouping works!
The problem i that the field on which i want to group by is not in the productConfiguration and getting it directly from the sortedPositions doesn;t group as expected.
Here is the xml:
<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="INVOICE_POSITIONS_PICASSO_TEMPLATE" pageWidth="555" pageHeight="802" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="2e9314a9-2d41-428a-91e9-63a890b65110">
<property name="ireport.zoom" value="1.6105100000000019"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<field name="quantity" class="java.math.BigDecimal"/>
<field name="id" class="java.lang.Long"/>
<field name="value" class="java.math.BigDecimal"/>
<field name="corridor" class="java.lang.String">
<fieldDescription><![CDATA[productConfiguration.invoicePositionList.get(0).corridor]]></fieldDescription>
</field>
<field name="description" class="java.lang.String"/>
<field name="productName" class="java.lang.String">
<fieldDescription><![CDATA[productConfiguration.product.name]]></fieldDescription>
</field>
<field name="invoiceConfigurationId" class="java.lang.Long">
<fieldDescription><![CDATA[productConfiguration.invoiceConfiguration.id]]></fieldDescription>
</field>
<field name="productDescription" class="java.lang.String">
<fieldDescription><![CDATA[productConfiguration.description]]></fieldDescription>
</field>
<field name="productConfigId" class="java.lang.Long">
<fieldDescription><![CDATA[productConfiguration.id]]></fieldDescription>
</field>
<field name="period" class="java.sql.Timestamp">
<fieldDescription><![CDATA[invoice.period]]></fieldDescription>
</field>
<variable name="sumValueFinal" class="java.math.BigDecimal" resetType="Group" resetGroup="ProductGroup" calculation="Sum">
<variableExpression><![CDATA[$F{value}.abs()]]></variableExpression>
</variable>
<group name="ProductGroup">
<groupExpression><![CDATA[$F{corridor}]]></groupExpression>
<groupFooter>
<band height="58">
<staticText>
<reportElement mode="Opaque" x="0" y="37" width="455" height="20" backcolor="#CCCCCC" uuid="87ce8c73-7c58-4775-87e4-307521c9f0fe"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="9" isBold="true"/>
<paragraph rightIndent="2"/>
</textElement>
<text><![CDATA[Subtotal:]]></text>
</staticText>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement mode="Opaque" x="460" y="37" width="95" height="20" backcolor="#CCCCCC" uuid="5456221b-3dee-46fc-a9a4-999da7067898"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="9"/>
<paragraph rightIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$V{sumValueFinal}.abs()]]></textFieldExpression>
</textField>
<staticText>
<reportElement mode="Opaque" x="0" y="8" width="45" height="20" backcolor="#FFFFFF" uuid="e3207aed-06dc-4e00-9eac-adab729b841b"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="9" isBold="true"/>
<paragraph rightIndent="2"/>
</textElement>
<text><![CDATA[GROUP FINAL]]></text>
</staticText>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement mode="Opaque" x="45" y="8" width="102" height="20" backcolor="#99FF99" uuid="e26a9f2a-b3c1-44df-b088-29f42dfea069"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="9"/>
<paragraph rightIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$F{productName}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement mode="Opaque" x="455" y="8" width="95" height="20" backcolor="#99FF99" uuid="e1f7c353-c700-4d8a-9aa8-1c17c2c94743"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="9"/>
<paragraph rightIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$F{value}.abs()]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement mode="Opaque" x="265" y="8" width="95" height="20" backcolor="#99FF99" uuid="7c9b2c7f-22c9-492f-a103-8047690a0080"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="9"/>
<paragraph rightIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$F{corridor}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement mode="Opaque" x="360" y="8" width="95" height="20" backcolor="#99FF99" uuid="351f7355-61aa-4c38-a2e7-1250f965f2eb"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="9"/>
<paragraph rightIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$F{quantity}.abs()]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement mode="Opaque" x="147" y="8" width="102" height="20" backcolor="#99FF99" uuid="3a2a9adb-2873-43e2-b8f5-48e3df353572"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="9"/>
<paragraph rightIndent="2"/>
</textElement>
<textFieldExpression><![CDATA[$F{quantity}]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
For reference the description -> NOT group correctly on the other hand the productDescription -> group correctly!
The issue was that the sortedPosition that i was "feeding" to the subreport wasn't properly and correctly sorted! Be careful the jasper group only makes one iteration through the data and the dataSource that you use for grouping should be sorted according what you want to group.

Why is my expression off by 1 record?

I have a report that i am making using iReport and I have an equation that is helping me find duplicate Estimated Shipping variables and make the initial number stay the same but the ones displayed after it appear as 0. I want this because the report shows the changes made to the Sales Order but I dont want the report showing that the person was charged the initial Estimated Shipping ammount- every time.
The equation I am using to find the duplicates is
$V{SOID_Count}<=1?$F{SOITEM_UNITPRICE}:0
This works but if you notice in this picture the numbers are behind by one.
It is subtracting the Estimated Shipping amount that was above it- from the current Actual Shipping amount that you are on.
So how can I alter my counter equation to fix this?
Thank you for any help!
This is my 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="ShippingPriceDifference" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="97636279-f825-4b72-b9f8-8ce9740dce34">
<property name="ireport.zoom" value="1.5"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="To" class="java.util.Date">
<parameterDescription><![CDATA[asdf]]></parameterDescription>
</parameter>
<parameter name="From" class="java.util.Date"/>
<queryString>
<![CDATA[SELECT
CUSTOMER."NAME" AS CUSTOMER_NAME,
SO."NUM" AS SO_NUM,
COMPANY."NAME" AS COMPANY_NAME,
SHIPCARTON."FREIGHTAMOUNT" AS SHIPCARTON_FREIGHTAMOUNT,
SHIP."SOID" AS SHIP_SOID,
SOITEM."UNITPRICE" AS SOITEM_UNITPRICE,
PRODUCT."PARTID" AS PRODUCT_PARTID,
SHIP."DATESHIPPED" AS SHIP_DATESHIPPED,
SOITEM."SOID" AS SOITEM_SOID
FROM
"CUSTOMER" CUSTOMER INNER JOIN "SO" SO ON CUSTOMER."ID" = SO."CUSTOMERID"
INNER JOIN "SHIP" SHIP ON SO."ID" = SHIP."SOID"
INNER JOIN "SOITEM" SOITEM ON SO."ID" = SOITEM."SOID"
INNER JOIN "PRODUCT" PRODUCT ON SOITEM."PRODUCTID" = PRODUCT."ID"
INNER JOIN "SHIPCARTON" SHIPCARTON ON SHIP."ID" = SHIPCARTON."SHIPID",
"COMPANY" COMPANY
WHERE
PRODUCT."PARTID" = 947
AND SHIP."DATESHIPPED" BETWEEN $P{From} AND $P{To}
AND SHIPCARTON."FREIGHTAMOUNT" != 0
ORDER BY
2 ASC]]>
</queryString>
<field name="CUSTOMER_NAME" class="java.lang.String"/>
<field name="SO_NUM" class="java.lang.String"/>
<field name="COMPANY_NAME" class="java.lang.String"/>
<field name="SHIPCARTON_FREIGHTAMOUNT" class="java.lang.Double"/>
<field name="SHIP_SOID" class="java.lang.Integer"/>
<field name="SOITEM_UNITPRICE" class="java.lang.Double"/>
<field name="PRODUCT_PARTID" class="java.lang.Integer"/>
<field name="SHIP_DATESHIPPED" class="java.sql.Timestamp"/>
<field name="SOITEM_SOID" class="java.lang.Integer"/>
<variable name="shipPriceDif" class="java.lang.Double">
<variableExpression><![CDATA[($F{SHIPCARTON_FREIGHTAMOUNT})- ($V{estimatedShipping})]]></variableExpression>
</variable>
<variable name="totalShipPriceDif" class="java.lang.Double" calculation="Sum">
<variableExpression><![CDATA[$V{shipPriceDif}]]></variableExpression>
</variable>
<variable name="SOID_Count" class="java.lang.Integer" resetType="Group" resetGroup="SOID" calculation="Count">
<variableExpression><![CDATA[$F{SOITEM_SOID}]]></variableExpression>
</variable>
<variable name="estimatedShipping" class="java.lang.Double">
<variableExpression><![CDATA[$V{SOID_Count}<=1?$F{SOITEM_UNITPRICE}:0]]> </variableExpression>
</variable>
<group name="SOID">
<groupExpression><![CDATA[$F{SOITEM_SOID}]]></groupExpression>
</group>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="27" splitType="Stretch">
<textField>
<reportElement x="0" y="0" width="555" height="25" uuid="64a1704a-b221-48a4-8186-1b855ead5acf"/>
<textElement textAlignment="Center">
<font fontName="SansSerif" size="16" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{COMPANY_NAME}]]></textFieldExpression>
</textField>
</band>
</title>
<pageHeader>
<band height="59" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="555" height="25" uuid="e20cae54-5d75-4e81-800c-55390d1ec465"/>
<textElement textAlignment="Center">
<font fontName="SansSerif" size="14"/>
</textElement>
<text><![CDATA[Shipping Price Difference ]]></text>
</staticText>
<staticText>
<reportElement x="0" y="25" width="167" height="20" uuid="41be06d8-8fdf-4e3b-b526-1aea092ea734"/>
<textElement textAlignment="Right">
<font fontName="SansSerif" size="14" isBold="false"/>
</textElement>
<text><![CDATA[Date Range:]]></text>
</staticText>
<staticText>
<reportElement x="267" y="25" width="20" height="20" uuid="a402544b-73b3-4132-8161-be4c202e9b14"/>
<textElement textAlignment="Center">
<font fontName="SansSerif" size="14" isBold="false"/>
</textElement>
<text><![CDATA[-]]></text>
</staticText>
<textField>
<reportElement x="287" y="25" width="100" height="20" uuid="85e7fe2b-8149-4b18-8410-16b026cdb0f3"/>
<textElement verticalAlignment="Middle">
<font fontName="SansSerif" size="14"/>
</textElement>
<textFieldExpression><![CDATA[$P{To}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="167" y="25" width="100" height="20" uuid="ea618bea-9201-4eba-abff-cfdc891ac76f"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="14"/>
</textElement>
<textFieldExpression><![CDATA[$P{From}]]></textFieldExpression>
</textField>
</band>
</pageHeader>
<columnHeader>
<band height="21" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="140" height="20" uuid="82883a63-752d-4265-8158-a5129b617b7d"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Customer Name]]></text>
</staticText>
<staticText>
<reportElement x="140" y="0" width="75" height="20" uuid="2d302854-c68c-4e5a-b94b-900c88937b9d"/>
<textElement textAlignment="Center">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[SO #]]></text>
</staticText>
<staticText>
<reportElement x="455" y="0" width="100" height="20" uuid="50c6ba0f-a5df-4aa3-8a47-282271055053"/>
<textElement textAlignment="Center">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Difference]]></text>
</staticText>
<line>
<reportElement x="0" y="19" width="555" height="1" uuid="be790d1c-d6d6-4169-b743-a98654c025e9"/>
</line>
<staticText>
<reportElement x="215" y="0" width="120" height="20" uuid="ffbe1333-86b8-435f-b914-46bb1c747683"/>
<textElement textAlignment="Center">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Estimated Shipping]]></text>
</staticText>
<staticText>
<reportElement x="335" y="0" width="120" height="20" uuid="3f683f6b-19f6-49dd-9ee1-787b216aaa2f"/>
<textElement textAlignment="Center">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Actual Shipping]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="21" splitType="Stretch">
<textField isBlankWhenNull="true">
<reportElement x="0" y="0" width="140" height="20" isRemoveLineWhenBlank="true" uuid="fdd69c30-9da5-4bd2-a7b8-44a506e2d7ff"/>
<textFieldExpression><![CDATA[$F{CUSTOMER_NAME}]]></textFieldExpression>
</textField>
<textField isBlankWhenNull="true" hyperlinkType="Reference">
<reportElement x="140" y="0" width="75" height="20" isRemoveLineWhenBlank="true" forecolor="#000099" uuid="19db6cb8-af37-46e6-9227-f1b55fc49f22"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{SO_NUM}]]></textFieldExpression>
<anchorNameExpression><![CDATA["SONum"]]></anchorNameExpression>
<hyperlinkReferenceExpression><![CDATA[$F{SO_NUM}]]></hyperlinkReferenceExpression>
</textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="335" y="0" width="120" height="20" isRemoveLineWhenBlank="true" uuid="006475e5-d36f-4482-97cf-2c2eda2d5a66"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$F{SHIPCARTON_FREIGHTAMOUNT}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00" isBlankWhenNull="true">
<reportElement x="215" y="0" width="120" height="20" isRemoveLineWhenBlank="true" uuid="376d9c76-1d96-48ea-ac4a-40770ba28867"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{estimatedShipping}]]></textFieldExpression>
</textField>
<textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
<reportElement x="455" y="0" width="100" height="20" isRemoveLineWhenBlank="true" uuid="c236c087-e6f4-4de6-a3d6-8abb8b798346"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{shipPriceDif}]]></textFieldExpression>
</textField>
</band>
</detail>
<pageFooter>
<band height="22" splitType="Stretch">
<textField>
<reportElement x="435" y="0" width="80" height="20" uuid="64e6c2aa-58eb-4994-83c3-16cb70197fef"/>
<textElement textAlignment="Right"/>
<textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
</textField>
<textField evaluationTime="Report">
<reportElement x="515" y="0" width="40" height="20" uuid="09e2e08b-c9b1-4a5b-95fd-1c0a0dba17a2"/>
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
<summary>
<band height="22" splitType="Stretch">
<textField pattern="#,##0.00;-#,##0.00">
<reportElement x="150" y="1" width="75" height="20" uuid="8ab3526d-e89e-4043-86dd-52d89a2b7b21"/>
<textElement verticalAlignment="Top">
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$V{totalShipPriceDif}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="140" y="1" width="10" height="20" uuid="110043fb-4dde-414e-b07f-f79cbb8839ab"/>
<textElement textAlignment="Right">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[$]]></text>
</staticText>
<line>
<reportElement x="0" y="0" width="555" height="1" uuid="e81602ee-7eab-43f3-90c1-cf69086623a9"/>
</line>
<staticText>
<reportElement x="0" y="1" width="140" height="20" uuid="095559e8-33e4-4a1a-9537-f8dff2b533d6"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Total Cost Difference :]]></text>
</staticText>
</band>
</summary>
</jasperReport>
Your problem is that the $V{estimatedShipping} is evaluated after your variable $V{shipPriceDif} since its after in your variable definition, or move it above or dump it...
Just calculate the Difference in the textField
<textField pattern="#,##0.00;-#,##0.00" isBlankWhenNull="true">
<reportElement x="455" y="0" width="100" height="20" isRemoveLineWhenBlank="true" uuid="c236c087-e6f4-4de6-a3d6-8abb8b798346"/>
<textElement textAlignment="Center"/>
<textFieldExpression><![CDATA[$V{estimatedShipping}.doubleValue()-$F{SHIPCARTON_FREIGHTAMOUNT}.doubleValue()]]></textFieldExpression>
</textField>
The output of this would be:
+-------+-----------+--------+------------+
| SO# | Estimated | Actual | Difference |
+-------+-----------+--------+------------+
| 46137 | 700 | 58,38 | 641,62 |
| 46137 | 0 | 57,12 | -57.12 |
| 46137 | 0 | 28,29 | -28,29 |
| 46148 | 0,85 | 267,32 | -266,47 |
+-------+-----------+--------+------------+

Removing blank entries from a Jasper report

I have created a report within the jrxml. I have specified to only print the details of each value if one of my fields is populated using the tag <printWhenExpression> with a value like so:
<textField>
<reportElement x="670" y="4" width="105" height="20" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[$F{name}!= null]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{value2}]]></textFieldExpression>
This works in filtering only relevant data, however it leaves me with a lot of blank rows within the report. I have enabled the condition isRemoveLineWhenBlank="true" to remove these blank rows from being displayed on my report. This has taken my report from 12 pages to 5, however, I still observe a large number of empty rows within the report.
Here is a ScreenShot of my reports design in ireport.
And here is a ScreenShot of the report run (I've blanked out my company's name from the classes)
The full report JRXML:
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="RIOBridgeReport" pageWidth="1530" pageHeight="842" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="10" rightMargin="5" topMargin="10" bottomMargin="10">
<property name="ireport.zoom" value="2.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="net.sf.jasperreports.export.xls.exclude.origin.keep.first.band.1" value="columnHeader"/>
<parameter name="title" class="java.lang.String"/>
<parameter name="oneliner" class="java.lang.String"/>
<field name="name" class="java.lang.String">
<fieldDescription><![CDATA[id[starts-with(.,'USCS')]]]></fieldDescription>
</field>
<field name="class" class="java.lang.String">
<fieldDescription><![CDATA[class]]></fieldDescription>
</field>
<field name="value" class="java.lang.String">
<fieldDescription><![CDATA[constructor-arg/value]]></fieldDescription>
</field>
<field name="value1" class="java.lang.String">
<fieldDescription><![CDATA[constructor-arg[1]/value]]></fieldDescription>
</field>
<field name="value2" class="java.lang.String">
<fieldDescription><![CDATA[constructor-arg[2]/value]]></fieldDescription>
</field>
<variable name="runDate" class="java.lang.String">
<initialValueExpression><![CDATA[new java.text.SimpleDateFormat("dd-MMM-yyyy HH:mm:ss Z").format(new java.util.Date())]]></initialValueExpression>
</variable>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="53" splitType="Stretch">
<textField isBlankWhenNull="true">
<reportElement x="12" y="12" width="496" height="20"/>
<textElement textAlignment="Center">
<font fontName="Arial" size="14" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{title} + " - " + $V{runDate}]]></textFieldExpression>
</textField>
<image>
<reportElement x="616" y="0" width="84" height="53"/>
<imageExpression><![CDATA["citi_corp_logo.gif"]]></imageExpression>
</image>
<textField isBlankWhenNull="true">
<reportElement x="12" y="32" width="496" height="20"/>
<textElement textAlignment="Center">
<font fontName="Arial" size="10" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{oneliner}]]></textFieldExpression>
</textField>
</band>
</title>
<columnHeader>
<band height="23" splitType="Stretch">
<staticText>
<reportElement x="12" y="2" width="85" height="20"/>
<textElement>
<font fontName="Arial" size="10" isBold="true" isUnderline="false"/>
</textElement>
<text><![CDATA[Bean Name]]></text>
</staticText>
<staticText>
<reportElement x="228" y="2" width="85" height="20"/>
<textElement>
<font fontName="Arial" size="10" isBold="true" isUnderline="false"/>
</textElement>
<text><![CDATA[Class]]></text>
</staticText>
<staticText>
<reportElement x="428" y="2" width="105" height="20"/>
<textElement>
<font fontName="Arial" size="10" isBold="true" isUnderline="false"/>
</textElement>
<text><![CDATA[Value]]></text>
</staticText>
<staticText>
<reportElement x="543" y="2" width="105" height="20"/>
<textElement>
<font fontName="Arial" size="10" isBold="true" isUnderline="false"/>
</textElement>
<text><![CDATA[Value1]]></text>
</staticText>
<staticText>
<reportElement x="670" y="2" width="105" height="20"/>
<textElement>
<font fontName="Arial" size="10" isBold="true" isUnderline="false"/>
</textElement>
<text><![CDATA[Value2]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="24">
<textField isBlankWhenNull="true">
<reportElement x="12" y="2" width="216" height="20" isRemoveLineWhenBlank="true">
<printWhenExpression><![CDATA[$F{name}!= null]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="228" y="2" width="185" height="20">
<printWhenExpression><![CDATA[$F{name}!= null]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{class}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="428" y="2" width="105" height="20">
<printWhenExpression><![CDATA[$F{name}!= null]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{value}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="543" y="4" width="105" height="20">
<printWhenExpression><![CDATA[$F{name}!= null]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{value1}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="670" y="4" width="105" height="20">
<printWhenExpression><![CDATA[$F{name}!= null]]></printWhenExpression>
</reportElement>
<textElement>
<font fontName="Arial" size="10"/>
</textElement>
<textFieldExpression><![CDATA[$F{value2}]]></textFieldExpression>
</textField>
</band>
</detail>
<noData>
<band height="20">
<staticText>
<reportElement x="146" y="0" width="200" height="20"/>
<textElement textAlignment="Center">
<font fontName="Arial" size="14" isBold="true"/>
</textElement>
<text><![CDATA[No data found]]></text>
</staticText>
</band>
</noData>
</jasperReport>
As you can see still a large amount of whitespace left within the report. Is there a way to completely remove them or push the blank rows to the end of the report.
Try placing everything inside a frame and add the "Remove line when blank" to the frame.
Instead of isRemoveLineWhenBlank for a field use the band properties of detail band. Therefore this condition should be put in the detail band properties printWhenExpression.
.

Formatting layout of Jasper report through iReport, to remove space between bands

I have the below report, developed using iReport 3.0 (we have to use this version because of system constraints). But no matter what I do, I can not get rid of the white space between the Page Header (addresses) and the Column Header.
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="customisation_summary" pageWidth="595" pageHeight="700" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isFloatColumnFooter="true">
<style name="alternateStyle" isDefault="false" backcolor="#FFFFFF" fontName="Arial">
<conditionalStyle>
<conditionExpression><![CDATA[new Boolean($V{REPORT_COUNT}.intValue() % 2 == 0)]]></conditionExpression>
<style isDefault="false" style="alternateStyle" backcolor="#F7F7F7"/>
</conditionalStyle>
</style>
<parameter name="orderId" class="java.lang.String">
<defaultValueExpression><![CDATA[new Integer(0).toString()]]></defaultValueExpression>
</parameter>
<parameter name="REPORT_IMG_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["C:\\kukri\\workspaces\\sts_3_0_0\\clubshop\\clubshop\\src\\main\\webapp\\jasper\\images\\"]]></defaultValueExpression>
</parameter>
<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["C:\\kukri\\workspaces\\sts_3_0_0\\clubshop\\clubshop\\src\\main\\webapp\\jasper\\"]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[SELECT so.customer_id, so.order_date, so.order_ref, p.product_code, p.colour_code, p.name, SUM(soi.quantity) AS quantity, sz.size, '-' AS uom, '-' AS location, scc.unit_charge, SUM(soi.quantity * scc.unit_charge) total_charge
FROM sales_order AS so, sales_order_item AS soi, product AS p, stock AS st, size AS sz, stock_currency_charge AS scc
WHERE so.id = soi.order_id
AND soi.stock_id = st.id
AND st.product_id = p.id
AND st.id = scc.stock_id
AND st.size_id = sz.id
AND so.currency = scc.currency_code
AND so.id = '$P!{orderId}'
GROUP BY st.id
ORDER BY p.name, sz.display_seq]]>
</queryString>
<field name="customer_id" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="order_date" class="java.sql.Timestamp">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="order_ref" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="product_code" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="colour_code" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="name" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="quantity" class="java.lang.Integer">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="size" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="uom" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="location" class="java.lang.String">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="unit_charge" class="java.math.BigDecimal">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="total_charge" class="java.math.BigDecimal">
<fieldDescription><![CDATA[]]></fieldDescription>
</field>
<title>
<band height="72" isSplitAllowed="false">
<image onErrorType="Icon">
<reportElement key="image-4" x="-1" y="0" width="555" height="71"/>
<imageExpression class="java.lang.String"><![CDATA[$P{REPORT_IMG_DIR} + "//Top_Image.png"]]></imageExpression>
</image>
<staticText>
<reportElement x="307" y="51" width="247" height="20"/>
<textElement textAlignment="Right">
<font size="14"/>
</textElement>
<text><![CDATA[Order Customisation Pick Sheet]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="45">
<staticText>
<reportElement x="399" y="2" width="62" height="18"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[Order Ref: ]]></text>
</staticText>
<textField>
<reportElement x="464" y="20" width="92" height="20"/>
<textElement textAlignment="Right" verticalAlignment="Middle"/>
<textFieldExpression class="java.util.Date"><![CDATA[$F{order_date}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="464" y="1" width="93" height="20"/>
<textElement textAlignment="Right" verticalAlignment="Middle"/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{order_ref}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="399" y="20" width="62" height="20"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font size="10" isBold="true"/>
</textElement>
<text><![CDATA[Order Date: ]]></text>
</staticText>
<subreport>
<reportElement x="179" y="1" width="175" height="40"/>
<subreportParameter name="customer_id">
<subreportParameterExpression><![CDATA[$F{customer_id}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "customisation_jobsheet_summary_invaddy.jasper"]]></subreportExpression>
</subreport>
<subreport>
<reportElement x="0" y="0" width="175" height="40"/>
<subreportParameter name="customer_id">
<subreportParameterExpression><![CDATA[$F{customer_id}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression class="java.lang.String"><![CDATA[$P{SUBREPORT_DIR} + "customisation_jobsheet_summary_del_addy.jasper"]]></subreportExpression>
</subreport>
</band>
</pageHeader>
<columnHeader>
<band height="20">
<staticText>
<reportElement mode="Opaque" x="23" y="1" width="79" height="18" backcolor="#CCCCCC"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Product Code]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="463" y="1" width="39" height="18" backcolor="#CCCCCC"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[UOM]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="178" y="1" width="231" height="18" backcolor="#CCCCCC"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Product ]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="102" y="1" width="76" height="18" backcolor="#CCCCCC"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Colour]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="409" y="1" width="26" height="18" backcolor="#CCCCCC"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Size]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="435" y="1" width="28" height="18" backcolor="#CCCCCC"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[QTY]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="501" y="1" width="55" height="18" backcolor="#CCCCCC"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[Location]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="2" y="1" width="21" height="18" backcolor="#CCCCCC"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="8" isBold="true"/>
</textElement>
<text><![CDATA[#]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="19">
<textField>
<reportElement style="alternateStyle" isPrintRepeatedValues="false" x="21" y="1" width="79" height="18"/>
<textElement textAlignment="Center"/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{product_code}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="alternateStyle" isPrintRepeatedValues="false" x="176" y="1" width="231" height="18"/>
<textElement/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{name}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="alternateStyle" isPrintRepeatedValues="false" x="100" y="1" width="76" height="18"/>
<textElement textAlignment="Center"/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{colour_code}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="alternateStyle" x="433" y="1" width="28" height="18"/>
<textElement textAlignment="Center"/>
<textFieldExpression class="java.lang.Integer"><![CDATA[$F{quantity}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="alternateStyle" x="461" y="1" width="39" height="18"/>
<textElement textAlignment="Center"/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{uom}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="alternateStyle" x="499" y="1" width="55" height="18"/>
<textElement textAlignment="Center"/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{location}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="0" y="1" width="21" height="18"/>
<textElement textAlignment="Center"/>
<textFieldExpression class="java.lang.Integer"><![CDATA[$V{REPORT_COUNT}]]></textFieldExpression>
</textField>
<textField>
<reportElement style="alternateStyle" x="407" y="1" width="26" height="18"/>
<textElement textAlignment="Center"/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{size}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="50"/>
</columnFooter>
<summary>
<band height="80"/>
</summary>
</jasperReport>

How to make the row not repeating properly according the field

i have create one statistical report according the gender.
The field names Jantina.
I have a problem when remove the Print repeating values. I just want the field is not repeating according the Jantina field. But unfortunately the row not repeating all the row without following the Jantina.
How to do that? Anyone got the idea?
This is my jrxml code:
<?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="penyata_bulanan_ikut_negeri_jantina_test" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<parameter name="bulan" class="java.lang.Integer">
<defaultValueExpression><![CDATA[new Integer(-1)]]></defaultValueExpression>
</parameter>
<parameter name="tahun" class="java.lang.Integer">
<defaultValueExpression><![CDATA[new Integer(-1)]]></defaultValueExpression>
</parameter>
<parameter name="negeri" class="java.lang.Integer">
<defaultValueExpression><![CDATA[new Integer(00)]]></defaultValueExpression>
</parameter>
<parameter name="jantina" class="java.lang.Long">
<defaultValueExpression><![CDATA[new Long(2)]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[SELECT #row := #row + 1 as r,bulan,tahun,negeri,jantina,
bilmale,jds,jumall,
ROUND(CAST((bilmale*100 /(jumall))AS DECIMAL(7,3)),2) as percent,
ROUND(CAST((jds*100 /(jumall))AS DECIMAL(7,3)),2) as p_jdk,
countstate
FROM some_table
group by date_format(X.createDate,'%Y' ),date_format(X.createDate,'%M' ),X.male,X.state
order by 1 asc) as a,(select #row := 0) as r]]>
</queryString>
<field name="r" class="java.lang.Long"/>
<field name="bulan" class="java.lang.String"/>
<field name="tahun" class="java.lang.String"/>
<field name="negeri" class="java.lang.String"/>
<field name="jantina" class="java.lang.String"/>
<field name="bilmale" class="java.math.BigDecimal"/>
<field name="jds" class="java.math.BigDecimal"/>
<field name="jumall" class="java.math.BigDecimal"/>
<field name="percent" class="java.math.BigDecimal"/>
<field name="p_jdk" class="java.math.BigDecimal"/>
<field name="countstate" class="java.lang.Long"/>
<sortField name="bulan"/>
<sortField name="tahun"/>
<sortField name="negeri"/>
<sortField name="jantina"/>
<group name="bulan">
<groupExpression><![CDATA[$F{bulan}]]></groupExpression>
<groupHeader>
<band/>
</groupHeader>
<groupFooter>
<band/>
</groupFooter>
</group>
<group name="jantina">
<groupExpression><![CDATA[$F{jantina}]]></groupExpression>
</group>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="48" splitType="Stretch">
<staticText>
<reportElement x="237" y="10" width="100" height="20"/>
<textElement>
<font fontName="Arial" size="12"/>
</textElement>
<text><![CDATA[Penyata bulanan]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="20" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="79" height="20"/>
<textElement textAlignment="Center">
<font fontName="Arial"/>
</textElement>
<text><![CDATA[negeri]]></text>
</staticText>
<staticText>
<reportElement x="79" y="0" width="79" height="20"/>
<textElement textAlignment="Center">
<font fontName="Arial"/>
</textElement>
<text><![CDATA[jantina]]></text>
</staticText>
<staticText>
<reportElement x="158" y="0" width="79" height="20"/>
<textElement textAlignment="Center">
<font fontName="Arial"/>
</textElement>
<text><![CDATA[bilmale]]></text>
</staticText>
<staticText>
<reportElement x="237" y="0" width="79" height="20"/>
<textElement textAlignment="Center">
<font fontName="Arial"/>
</textElement>
<text><![CDATA[jds]]></text>
</staticText>
<staticText>
<reportElement x="316" y="0" width="79" height="20"/>
<textElement textAlignment="Center">
<font fontName="Arial"/>
</textElement>
<text><![CDATA[percent]]></text>
</staticText>
<staticText>
<reportElement x="395" y="0" width="79" height="20"/>
<textElement textAlignment="Center">
<font fontName="Arial"/>
</textElement>
<text><![CDATA[p_jdk]]></text>
</staticText>
<staticText>
<reportElement x="474" y="0" width="79" height="20"/>
<textElement textAlignment="Center">
<font fontName="Arial"/>
</textElement>
<text><![CDATA[countstate]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="20" splitType="Stretch">
<textField>
<reportElement x="0" y="0" width="79" height="20"/>
<textElement textAlignment="Center">
<font fontName="Arial"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{negeri}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="79" y="0" width="79" height="20"/>
<textElement textAlignment="Center">
<font fontName="Arial"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{jantina}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="158" y="0" width="79" height="20"/>
<textElement textAlignment="Center">
<font fontName="Arial"/>
</textElement>
<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{bilmale}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="237" y="0" width="79" height="20"/>
<textElement textAlignment="Center">
<font fontName="Arial"/>
</textElement>
<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{jds}]]></textFieldExpression>
</textField>
<textField>
<reportElement isPrintRepeatedValues="false" x="316" y="0" width="79" height="20"/>
<textElement textAlignment="Center">
<font fontName="Arial"/>
</textElement>
<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{percent}]]></textFieldExpression>
</textField>
<textField>
<reportElement isPrintRepeatedValues="false" x="395" y="0" width="79" height="20"/>
<textElement textAlignment="Center">
<font fontName="Arial"/>
</textElement>
<textFieldExpression class="java.math.BigDecimal"><![CDATA[$F{p_jdk}]]></textFieldExpression>
</textField>
<textField>
<reportElement isPrintRepeatedValues="false" x="474" y="0" width="79" height="20"/>
<textElement textAlignment="Center">
<font fontName="Arial"/>
</textElement>
<textFieldExpression class="java.lang.Long"><![CDATA[$F{countstate}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band splitType="Stretch"/>
</pageFooter>
<summary>
<band splitType="Stretch"/>
</summary>
</jasperReport>
The answer is i create the group and put this formula in
"Print When Expression" into field. That is new Boolean($V{negeri_COUNT}.intValue()==1)
and i uncheck "Print Repeated values "