Jump to content
We've recently updated our Privacy Statement, available here ×

Remove Line When Blank not working in table


israt.suthar

Recommended Posts

I have created one demo report with sample db. I want to remove row which field is blank or null, but "removelinewhenblank" is not working I am using table inside a frame.

Pasting JRXML as well as a link of table image with blank fields https://imgur.com/a/m299sVg

As per image 1st,4th and 10th record should not be displayed in the report.

P.S: I can not modify my SQL query Your help will be so appreciable JRXML: <?xml version="1.0" encoding="UTF-8"?>

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.3.0.final using JasperReports Library version 6.3.0  -->
<!-- 2019-06-06T13:22:03 -->
<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="New Test Report" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="7a5c9b49-9dc5-422a-ac69-e92cf61ef530">
    <property name="com.jaspersoft.studio.data.sql.tables" value=""/>
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="Sample DB"/>
    <style name="Title" forecolor="#FFFFFF" fontName="Times New Roman" fontSize="50" isBold="false"/>
    <style name="SubTitle" forecolor="#CCCCCC" fontName="Times New Roman" fontSize="18" isBold="false"/>
    <style name="Column header" forecolor="#666666" fontName="Times New Roman" fontSize="14" isBold="true"/>
    <style name="Detail" mode="Transparent" fontName="Times New Roman"/>
    <style name="Row" mode="Transparent" fontName="Times New Roman" pdfFontName="Times-Roman">
        <conditionalStyle>
            <conditionExpression><![CDATA[$V{REPORT_COUNT}%2 == 0]]></conditionExpression>
            <style mode="Opaque" backcolor="#F0EFEF"/>
        </conditionalStyle>
    </style>
    <style name="Table_TH" mode="Opaque" backcolor="#F0F8FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
            <topPen lineWidth="0.5" lineColor="#000000"/>
            <leftPen lineWidth="0.5" lineColor="#000000"/>
            <bottomPen lineWidth="0.5" lineColor="#000000"/>
            <rightPen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="Table_CH" mode="Opaque" backcolor="#BFE1FF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
            <topPen lineWidth="0.5" lineColor="#000000"/>
            <leftPen lineWidth="0.5" lineColor="#000000"/>
            <bottomPen lineWidth="0.5" lineColor="#000000"/>
            <rightPen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <style name="Table_TD" mode="Opaque" backcolor="#FFFFFF">
        <box>
            <pen lineWidth="0.5" lineColor="#000000"/>
            <topPen lineWidth="0.5" lineColor="#000000"/>
            <leftPen lineWidth="0.5" lineColor="#000000"/>
            <bottomPen lineWidth="0.5" lineColor="#000000"/>
            <rightPen lineWidth="0.5" lineColor="#000000"/>
        </box>
    </style>
    <subDataset name="Dataset1" uuid="112b043b-2f03-41f3-8b49-ca07709209cd">
        <property name="com.jaspersoft.studio.data.sql.tables" value=""/>
        <property name="com.jaspersoft.studio.data.defaultdataadapter" value="Sample DB"/>
        <queryString>
            <![CDATA[select * from  "ADDRESS"]]>
        </queryString>
        <field name="ID" class="java.lang.Integer"/>
        <field name="FIRSTNAME" class="java.lang.String"/>
        <field name="LASTNAME" class="java.lang.String"/>
        <field name="STREET" class="java.lang.String"/>
        <field name="CITY" class="java.lang.String"/>
    </subDataset>
    <queryString>
        <![CDATA[select * from  "ADDRESS"]]>
    </queryString>
    <field name="ID" class="java.lang.Integer"/>
    <field name="FIRSTNAME" class="java.lang.String"/>
    <field name="LASTNAME" class="java.lang.String"/>
    <field name="STREET" class="java.lang.String"/>
    <field name="CITY" class="java.lang.String"/>
    <group name="Group2">
        <groupExpression><![CDATA[(int)($V{REPORT_COUNT}/5)]]></groupExpression>
    </group>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="102" splitType="Stretch">
            <image>
                <reportElement x="725" y="0" width="77" height="102" uuid="651ccc4b-e999-40fe-bcbf-1f25bcfc98af"/>
                <imageExpression><![CDATA["cherry.jpg"]]></imageExpression>
            </image>
            <frame>
                <reportElement mode="Opaque" x="0" y="0" width="721" height="66" backcolor="#000000" uuid="d8d9e644-3a32-491d-97cb-a277aff17133"/>
                <staticText>
                    <reportElement style="Title" x="0" y="0" width="370" height="66" uuid="27d8f6ee-f0a9-44f6-a160-1763c3b00f30"/>
                    <box topPadding="4" leftPadding="4" bottomPadding="4" rightPadding="4"/>
                    <textElement verticalAlignment="Bottom">
                        <font isBold="false"/>
                    </textElement>
                    <text><![CDATA[Cherry Title]]></text>
                </staticText>
                <staticText>
                    <reportElement style="SubTitle" x="370" y="37" width="316" height="29" uuid="cfa21334-0634-4605-9ea7-aca4981f67e4"/>
                    <textElement textAlignment="Right">
                        <font size="22" isBold="false"/>
                    </textElement>
                    <text><![CDATA[Cherry SubTitle]]></text>
                </staticText>
            </frame>
            <frame>
                <reportElement mode="Opaque" x="0" y="70" width="721" height="32" forecolor="#000000" backcolor="#CC0000" uuid="b0c895f6-6dbd-477d-9858-9ad66af087e1"/>
                <textField pattern="EEEEE dd MMMMM yyyy">
                    <reportElement x="553" y="12" width="144" height="20" forecolor="#FFFFFF" uuid="a33fce3b-20c1-4696-873a-fe134d1e7d88"/>
                    <textElement textAlignment="Right">
                        <font size="12"/>
                    </textElement>
                    <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
                </textField>
            </frame>
        </band>
    </title>
    <pageHeader>
        <band splitType="Stretch"/>
    </pageHeader>
    <columnHeader>
        <band height="18" splitType="Stretch"/>
    </columnHeader>
    <detail>
        <band height="60" splitType="Stretch">
            <printWhenExpression><![CDATA[$F{LASTNAME} != null]]></printWhenExpression>
            <frame>
                <reportElement style="Row" positionType="Float" mode="Opaque" x="0" y="0" width="530" height="60" isRemoveLineWhenBlank="true" uuid="34a2ae4b-4055-476b-8676-d499f6af510b"/>
                <componentElement>
                    <reportElement x="0" y="0" width="530" height="60" uuid="4872d96c-c74d-44fc-a9ee-b4710ab3bdfe">
                        <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
                        <property name="com.jaspersoft.studio.table.style.table_header" value="Table_TH"/>
                        <property name="com.jaspersoft.studio.table.style.column_header" value="Table_CH"/>
                        <property name="com.jaspersoft.studio.table.style.detail" value="Table_TD"/>
                        <printWhenExpression><![CDATA[$F{LASTNAME} != ""]]></printWhenExpression>
                    </reportElement>
                    <jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
                        <datasetRun subDataset="Dataset1" uuid="987b9f1e-bdb9-4509-b200-36ad34a3851a">
                            <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                        </datasetRun>
                        <jr:column width="100" uuid="e43202c6-7694-4951-b75b-ab9a154254f4">
                            <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/>
                            <jr:columnHeader style="Table_CH" height="30">
                                <staticText>
                                    <reportElement x="0" y="0" width="100" height="30" uuid="62c5a5c6-8d97-4669-bd39-a5f1da850bb1"/>
                                    <text><![CDATA[iD]]></text>
                                </staticText>
                            </jr:columnHeader>
                            <jr:detailCell style="Table_TD" height="30">
                                <textField>
                                    <reportElement x="0" y="0" width="100" height="30" uuid="51888701-d7ad-478e-9196-a752f7586475"/>
                                    <textFieldExpression><![CDATA[$F{ID}]]></textFieldExpression>
                                </textField>
                            </jr:detailCell>
                        </jr:column>
                        <jr:column width="130" uuid="d2df8a59-55e5-4fdb-af3a-c65d24fc38bd">
                            <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/>
                            <jr:columnHeader style="Table_CH" height="30">
                                <staticText>
                                    <reportElement x="0" y="0" width="130" height="30" uuid="8581ad84-fe4d-4b15-890e-53f7f4433573"/>
                                    <text><![CDATA[FIRSTNAME]]></text>
                                </staticText>
                            </jr:columnHeader>
                            <jr:detailCell style="Table_TD" height="30">
                                <textField>
                                    <reportElement positionType="Float" x="0" y="0" width="130" height="30" uuid="b8ea0023-0783-4b24-95d0-3096447e5e04"/>
                                    <textFieldExpression><![CDATA[$F{FIRSTNAME}]]></textFieldExpression>
                                </textField>
                            </jr:detailCell>
                        </jr:column>
                        <jr:column width="120" uuid="519bdb42-9d95-41eb-a442-eae3595f4cf0">
                            <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column3"/>
                            <jr:columnHeader style="Table_CH" height="30">
                                <staticText>
                                    <reportElement x="0" y="0" width="120" height="30" uuid="847dacf9-1df8-4bb0-8b30-a23444780f7e"/>
                                    <text><![CDATA[LASTNAME]]></text>
                                </staticText>
                            </jr:columnHeader>
                            <jr:detailCell style="Table_TD" height="30">
                                <textField>
                                    <reportElement positionType="Float" x="0" y="0" width="120" height="30" isRemoveLineWhenBlank="true" uuid="9ec127e0-391f-406d-b9a2-241ff4c36c70">
                                        <printWhenExpression><![CDATA[$F{LASTNAME} != ""]]></printWhenExpression>
                                    </reportElement>
                                    <textFieldExpression><![CDATA[$F{CITY}.equals("Dallas")?"":$F{LASTNAME}]]></textFieldExpression>
                                </textField>
                            </jr:detailCell>
                        </jr:column>
                        <jr:column width="90" uuid="26d846e6-cf14-462f-a854-2d5833f78dfa">
                            <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column4"/>
                            <jr:columnHeader style="Table_CH" height="30">
                                <staticText>
                                    <reportElement x="0" y="0" width="90" height="30" uuid="09bc336b-3121-425f-956b-518a8f9c3116"/>
                                    <text><![CDATA[sTREET]]></text>
                                </staticText>
                            </jr:columnHeader>
                            <jr:detailCell style="Table_TD" height="30">
                                <textField>
                                    <reportElement positionType="Float" x="0" y="0" width="90" height="30" uuid="10284925-3469-45ad-9982-6ca1389a5728"/>
                                    <textFieldExpression><![CDATA[$F{STREET}]]></textFieldExpression>
                                </textField>
                            </jr:detailCell>
                        </jr:column>
                        <jr:column width="90" uuid="a787017d-598d-43c2-a659-2556facb685d">
                            <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column5"/>
                            <jr:columnHeader style="Table_CH" height="30">
                                <staticText>
                                    <reportElement x="0" y="0" width="90" height="30" uuid="278536a5-e923-4d43-bd8e-09956dcdd0b4"/>
                                    <text><![CDATA[CITY]]></text>
                                </staticText>
                            </jr:columnHeader>
                            <jr:detailCell style="Table_TD" height="30">
                                <textField>
                                    <reportElement positionType="Float" x="0" y="0" width="90" height="30" uuid="fa18df79-e49c-442f-b2bd-6f8bdbbedc2c"/>
                                    <textFieldExpression><![CDATA[$F{CITY}]]></textFieldExpression>
                                </textField>
                            </jr:detailCell>
                        </jr:column>
                    </jr:table>
                </componentElement>
            </frame>
        </band>
    </detail>
    <columnFooter>
        <band height="7" splitType="Stretch">
            <line>
                <reportElement positionType="FixRelativeToBottom" x="0" y="3" width="555" height="1" uuid="501ac6c4-e9d4-43cb-ba6b-7f2f44394cf3"/>
                <graphicElement>
                    <pen lineWidth="0.5" lineColor="#999999"/>
                </graphicElement>
            </line>
        </band>
    </columnFooter>
    <summary>
        <band splitType="Stretch"/>
    </summary>
</jasperReport>
 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...