Kollin.Meadows Posted March 20, 2019 Share Posted March 20, 2019 Hi all,I'm relatively familiar with Jaspersoft Studio but I'm trying to display a single row on a table element from a XML datasource.I've tried:Setting all the other entries to null to remove them.Wrote the expression to evaluate $F{Type}.equals("CLOSINGAGENT") ? $F{Type} : null.Sets all the other entries to null.Set all the null entries to display blank.Set the field to “Remove Line when Blank”.This just leave the other entries blank with whitespace. Any help or insight would be apprciated! Link to comment Share on other sites More sharing options...
C-Box Posted March 20, 2019 Share Posted March 20, 2019 Not sure what the actual problem is, but be aware that your field "Type" could also be null... so calling $F{Type}.equals(...) causes an internal NullPointer Exception.So better try the "other" syntax:"CLOSINGAGENT".equals($F{Type}) ? $F{Type} : nullOtherwise post your JRXML and the wanted + current result.hth +regards C-Box Link to comment Share on other sites More sharing options...
Kollin.Meadows Posted March 25, 2019 Author Share Posted March 25, 2019 Thanks for the quick reply!I went ahead and tried that solution with no luck. I'll post my JRXML here with my datasource XML, along with the desired result.<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="Blank_A4" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" isFloatColumnFooter="true" whenResourceMissingType="Empty" uuid="19c46b9e-e9a8-41e3-b761-b0e25086f336"> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="TableTest.xml"/> <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="PartyList" uuid="878433aa-56e8-41b9-b138-ea94400cb03a"> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="TableTest.xml"/> <queryString language="xPath"> <![CDATA[/RealEC-XML/Transaction/PartyList/Party]]> </queryString> <field name="FirstName" class="java.lang.String"> <property name="net.sf.jasperreports.xpath.field.expression" value="FirstName"/> <fieldDescription><![CDATA[FirstName]]></fieldDescription> </field> <field name="LastName" class="java.lang.String"> <property name="net.sf.jasperreports.xpath.field.expression" value="LastName"/> <fieldDescription><![CDATA[LastName]]></fieldDescription> </field> <field name="PrimaryName" class="java.lang.String"> <property name="net.sf.jasperreports.xpath.field.expression" value="PrimaryName"/> <fieldDescription><![CDATA[PrimaryName]]></fieldDescription> </field> <field name="EMail" class="java.lang.String"> <property name="net.sf.jasperreports.xpath.field.expression" value="EMail"/> <fieldDescription><![CDATA[EMail]]></fieldDescription> </field> <field name="Type" class="java.lang.String"> <property name="net.sf.jasperreports.xpath.field.expression" value="Type"/> <fieldDescription><![CDATA[Type]]></fieldDescription> </field> <field name="DayPhone" class="java.lang.String"> <property name="net.sf.jasperreports.xpath.field.expression" value="DayPhone"/> <fieldDescription><![CDATA[DayPhone]]></fieldDescription> </field> <field name="Addr1" class="java.lang.String"> <property name="net.sf.jasperreports.xpath.field.expression" value="Addr1"/> <fieldDescription><![CDATA[Addr1]]></fieldDescription> </field> <field name="Addr2" class="java.lang.String"> <property name="net.sf.jasperreports.xpath.field.expression" value="Addr2"/> <fieldDescription><![CDATA[Addr2]]></fieldDescription> </field> </subDataset> <queryString language="xPath"> <![CDATA[/RealEC-XML/Transaction/PartyList/Party]]> </queryString> <field name="LastName" class="java.lang.String"> <property name="net.sf.jasperreports.xpath.field.expression" value="LastName"/> <fieldDescription><![CDATA[LastName]]></fieldDescription> </field> <field name="PrimaryName" class="java.lang.String"> <property name="net.sf.jasperreports.xpath.field.expression" value="PrimaryName"/> <fieldDescription><![CDATA[PrimaryName]]></fieldDescription> </field> <field name="Type" class="java.lang.String"> <property name="net.sf.jasperreports.xpath.field.expression" value="Type"/> <fieldDescription><![CDATA[Type]]></fieldDescription> </field> <field name="UniqueID" class="java.lang.Integer"> <property name="net.sf.jasperreports.xpath.field.expression" value="UniqueID"/> <fieldDescription><![CDATA[uniqueID]]></fieldDescription> </field> <field name="DayPhone" class="java.lang.String"> <property name="net.sf.jasperreports.xpath.field.expression" value="DayPhone"/> <fieldDescription><![CDATA[DayPhone]]></fieldDescription> </field> <field name="EMail" class="java.lang.String"> <property name="net.sf.jasperreports.xpath.field.expression" value="EMail"/> <fieldDescription><![CDATA[EMail]]></fieldDescription> </field> <field name="FirstName" class="java.lang.String"> <property name="net.sf.jasperreports.xpath.field.expression" value="FirstName"/> <fieldDescription><![CDATA[FirstName]]></fieldDescription> </field> <field name="PartyRoleCode" class="java.lang.Integer"> <property name="net.sf.jasperreports.xpath.field.expression" value="PartyRoleCode"/> <fieldDescription><![CDATA[PartyRoleCode]]></fieldDescription> </field> <field name="TypeClass" class="java.lang.String"> <property name="net.sf.jasperreports.xpath.field.expression" value="TypeClass"/> <fieldDescription><![CDATA[TypeClass]]></fieldDescription> </field> <field name="TypeOtherDesc" class="java.lang.String"> <property name="net.sf.jasperreports.xpath.field.expression" value="TypeOtherDesc"/> <fieldDescription><![CDATA[TypeOtherDesc]]></fieldDescription> </field> <field name="Addr1" class="java.lang.String"> <property name="net.sf.jasperreports.xpath.field.expression" value="Addr1"/> <fieldDescription><![CDATA[Addr1]]></fieldDescription> </field> <field name="Addr2" class="java.lang.String"> <property name="net.sf.jasperreports.xpath.field.expression" value="Addr2"/> <fieldDescription><![CDATA[Addr2]]></fieldDescription> </field> <field name="AddressType" class="java.lang.String"> <property name="net.sf.jasperreports.xpath.field.expression" value="AddressType"/> <fieldDescription><![CDATA[AddressType]]></fieldDescription> </field> <field name="City" class="java.lang.String"> <property name="net.sf.jasperreports.xpath.field.expression" value="City"/> <fieldDescription><![CDATA[City]]></fieldDescription> </field> <field name="CompanyName" class="java.lang.String"> <property name="net.sf.jasperreports.xpath.field.expression" value="CompanyName"/> <fieldDescription><![CDATA[CompanyName]]></fieldDescription> </field> <field name="State" class="java.lang.String"> <property name="net.sf.jasperreports.xpath.field.expression" value="State"/> <fieldDescription><![CDATA[state]]></fieldDescription> </field> <field name="Zip" class="java.lang.Integer"> <property name="net.sf.jasperreports.xpath.field.expression" value="Zip"/> <fieldDescription><![CDATA[Zip]]></fieldDescription> </field> <sortField name="Type" order="Descending"/> <sortField name="PrimaryName" order="Descending"/> <group name="Type"> <groupExpression><![CDATA[$F{Type}]]></groupExpression> </group> <group name="PrimaryName"> <groupExpression><![CDATA[$F{PrimaryName}]]></groupExpression> </group> <background> <band splitType="Stretch"/> </background> <detail> <band height="354" splitType="Stretch"> <componentElement> <reportElement positionType="Float" isPrintRepeatedValues="false" x="0" y="10" width="545" height="60" isRemoveLineWhenBlank="true" uuid="63c04d40-05e5-4587-9b90-44268dad450a"> <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"/> </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" whenNoDataType="Blank"> <datasetRun subDataset="PartyList" uuid="eac11862-8de2-4772-ac05-dbf284d15fc5"> <parametersMapExpression><![CDATA[$P{REPORT_PARAMETERS_MAP}]]></parametersMapExpression> </datasetRun> <jr:column width="75" uuid="68da3081-46f4-40a6-ba08-f71b46b53f05"> <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column1"/> <jr:columnHeader style="Table_CH" height="30" rowSpan="1"> <staticText> <reportElement x="0" y="0" width="75" height="30" uuid="9941846b-5a60-4a0c-8a6f-139a211c1c0e"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10"/> </textElement> <text><![CDATA[FirstName]]></text> </staticText> </jr:columnHeader> <jr:detailCell style="Table_TD" height="30"> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement isPrintRepeatedValues="false" x="0" y="0" width="75" height="30" isRemoveLineWhenBlank="true" uuid="b5d5bf59-8cd0-4f63-9fab-7290052c25dc"> <printWhenExpression><![CDATA["CLOSINGAGENT".equals($F{Type})]]></printWhenExpression> </reportElement> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10"/> </textElement> <textFieldExpression><![CDATA[$F{FirstName}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="75" uuid="07493185-74ab-4942-b20b-69c092851b87"> <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column2"/> <jr:columnHeader style="Table_CH" height="30" rowSpan="1"> <staticText> <reportElement x="0" y="0" width="75" height="30" uuid="5933c355-b181-41be-9243-e9fa11a7c76d"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10"/> </textElement> <text><![CDATA[LastName]]></text> </staticText> </jr:columnHeader> <jr:detailCell style="Table_TD" height="30"> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement isPrintRepeatedValues="false" x="0" y="0" width="75" height="30" isRemoveLineWhenBlank="true" uuid="99714f2f-b95e-41f9-bc56-40b121a6aa90"> <printWhenExpression><![CDATA["CLOSINGAGENT".equals($F{Type})]]></printWhenExpression> </reportElement> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10"/> </textElement> <textFieldExpression><![CDATA[$F{LastName}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="75" uuid="c489b8b6-2540-445e-8a63-98da74659b83"> <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column3"/> <jr:columnHeader style="Table_CH" height="30" rowSpan="1"> <staticText> <reportElement x="0" y="0" width="75" height="30" uuid="7743de95-8958-4bc7-af6b-e49127553574"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10"/> </textElement> <text><![CDATA[PrimaryName]]></text> </staticText> </jr:columnHeader> <jr:detailCell style="Table_TD" height="30"> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement isPrintRepeatedValues="false" x="0" y="0" width="75" height="30" isRemoveLineWhenBlank="true" uuid="82f97e3e-40c8-4e65-80a0-ffed1e383ea8"> <printWhenExpression><![CDATA["CLOSINGAGENT".equals($F{Type})]]></printWhenExpression> </reportElement> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10"/> </textElement> <textFieldExpression><![CDATA[$F{PrimaryName}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="65" uuid="0746abf1-3823-40a0-945d-f16c4eab2023"> <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column4"/> <jr:columnHeader style="Table_CH" height="30" rowSpan="1"> <staticText> <reportElement x="0" y="0" width="65" height="30" uuid="10336a91-b728-4689-8bbf-967a3066a532"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10"/> </textElement> <text><![CDATA[EMail]]></text> </staticText> </jr:columnHeader> <jr:detailCell style="Table_TD" height="30"> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement isPrintRepeatedValues="false" x="0" y="0" width="65" height="30" isRemoveLineWhenBlank="true" uuid="fbf9432c-c009-44f2-bf77-af26191b6cd9"> <printWhenExpression><![CDATA["CLOSINGAGENT".equals($F{Type})]]></printWhenExpression> </reportElement> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10"/> </textElement> <textFieldExpression><![CDATA[$F{EMail}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="75" uuid="eab2be60-4f9d-48bc-802f-d922bfa0dfe5"> <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column5"/> <jr:columnHeader style="Table_CH" height="30" rowSpan="1"> <staticText> <reportElement x="0" y="0" width="75" height="30" uuid="e8e169be-53f5-45be-aa8b-3a76e15fc593"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10"/> </textElement> <text><![CDATA[Type]]></text> </staticText> </jr:columnHeader> <jr:detailCell style="Table_TD" height="30"> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement isPrintRepeatedValues="false" x="0" y="0" width="75" height="30" isRemoveLineWhenBlank="true" uuid="a1c7f3e6-e3d9-462f-a6e2-07ccbaac2a0d"> <printWhenExpression><![CDATA["CLOSINGAGENT".equals($F{Type})]]></printWhenExpression> </reportElement> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10"/> </textElement> <textFieldExpression><![CDATA[$F{Type}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="55" uuid="d394249a-6320-4d10-807a-ad70df38ca31"> <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column6"/> <jr:columnHeader style="Table_CH" height="30" rowSpan="1"> <staticText> <reportElement x="0" y="0" width="55" height="30" uuid="dc48f5f6-610c-412f-a733-fb54352e142a"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10"/> </textElement> <text><![CDATA[DayPhone]]></text> </staticText> </jr:columnHeader> <jr:detailCell style="Table_TD" height="30"> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement isPrintRepeatedValues="false" x="0" y="0" width="55" height="30" isRemoveLineWhenBlank="true" uuid="43dc8f9a-3303-4f06-9db0-fcdf3cb43e69"> <printWhenExpression><![CDATA["CLOSINGAGENT".equals($F{Type})]]></printWhenExpression> </reportElement> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10"/> </textElement> <textFieldExpression><![CDATA[$F{DayPhone}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> <jr:column width="125" uuid="abf9db61-5fb1-4d0a-a606-653b5537d19c"> <property name="com.jaspersoft.studio.components.table.model.column.name" value="Column7"/> <jr:columnHeader style="Table_CH" height="30" rowSpan="1"> <staticText> <reportElement x="0" y="0" width="125" height="30" uuid="cd47ab1b-e013-4503-a153-d6cbc32753e8"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10"/> </textElement> <text><![CDATA[Addr1]]></text> </staticText> </jr:columnHeader> <jr:detailCell style="Table_TD" height="30"> <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement isPrintRepeatedValues="false" x="0" y="0" width="125" height="30" isRemoveLineWhenBlank="true" uuid="d31885ea-2188-4369-b119-a47282ab3507"> <printWhenExpression><![CDATA["CLOSINGAGENT".equals($F{Type})]]></printWhenExpression> </reportElement> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="10"/> </textElement> <textFieldExpression><![CDATA[$F{Addr1}]]></textFieldExpression> </textField> </jr:detailCell> </jr:column> </jr:table> </componentElement> </band> </detail></jasperReport><?xml version="1.0" encoding="ISO-8859-1"?><?xml-stylesheet type="text/xsl" href="Test.xsl"?><RealEC-XML> <Header> <AckRef>1</AckRef> <AckRequest>NO</AckRequest> <Created>2018/10/12 15:28:28</Created> <CreatedBy>1111111</CreatedBy> <Format>Default</Format> <GMTOffset>-5</GMTOffset> <SourceApp>Bank NA Inbound</SourceApp> <SourceID>3802</SourceID> <SourceVer>12.3</SourceVer> <UserName>123456789</UserName> <Version>1</Version> </Header> <Transaction> <PartyList> <Count>18</Count> <Party> <LastName>Case1</LastName> <PrimaryName>Test Case1</PrimaryName> <Type>OTHER</Type> <UniqueID>19</UniqueID> <DayPhone>222 222-2222</DayPhone> <EMail>Test.Case1@test.com</EMail> <FirstName>Test</FirstName> <MiddleName></MiddleName> <PartyRoleCode>00000719356</PartyRoleCode> <TypeClass>INDV</TypeClass> <TypeOtherDesc>RequestingParty</TypeOtherDesc> </Party> <Party> <LastName>Bank NA</LastName> <PrimaryName>Bank NA</PrimaryName> <Type>LEND</Type> <UniqueID>21</UniqueID> <Addr1>Bank Document Management</Addr1> <Addr2>1111 Bank Way</Addr2> <AddressList> <Address> <AddressAdditionalLineText>1111 Bank Way</AddressAdditionalLineText> <AddressLineText>Bank Document Management</AddressLineText> <AddressType>MAILING</AddressType> <CityName>Someplace</CityName> <PostalCode>11111</PostalCode> <StateCode>SP</StateCode> </Address> </AddressList> <AddressType>MAILING</AddressType> <City>Someplace</City> <CompanyName>Bank NA</CompanyName> <FirstName>NA</FirstName> <PartyRoleCode>1</PartyRoleCode> <State>SP</State> <TypeOtherDesc>Lender</TypeOtherDesc> <Zip>11111</Zip> </Party> <Party> <LastName>Case3</LastName> <PrimaryName>Test Case3</PrimaryName> <Type>CLOSINGAGENT</Type> <UniqueID>33</UniqueID> <DayPhone>123 456-7890</DayPhone> <FirstName>Test</FirstName> <RoleList> <Role> <RoleDetail> <PartyRoleType>ClosingAgent</PartyRoleType> </RoleDetail> <SequenceNumber>1</SequenceNumber> <PartyRoleIdentifierList> <PartyRoleIdentifier> <SequenceNumber>14</SequenceNumber> <PartyRoleIdentifierValue>16569017</PartyRoleIdentifierValue> <PartyIdentifierOwnerURI>urn:fdc:lender.com:2017:LDD:PartyRoleID</PartyIdentifierOwnerURI> </PartyRoleIdentifier> </PartyRoleIdentifierList> </Role> </RoleList> <TypeClass>INDV</TypeClass> <TypeOtherDesc>ClosingAgent</TypeOtherDesc> </Party> </PartyList> </Transaction></RealEC-XML>Desired Result would be for the first two entries to not appear as whitespace thus leaving the Test Case3 as the first and only entry in the table. Thanks for your help! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now