Jump to content
Changes to the Jaspersoft community edition download ×

List within jr dataset - Javabean - List Component


vigneshwaran.ganesan

Recommended Posts

I am using JasperStudio plugin in the eclipse using Java. I have below scenario to generate reports in detail band.

IdLineItem
1          1
SourceNumber:1
DestinationNumber:1
2
3
4
2          2
SourceNumber:10
DestinationNumber:10
20
30
40

 

Java Bean:

public class Advance {
    private String id;
    private List<LineItem> lineItem;
}

public class LineItem {
    private String lineNumber;
    private String sourceNumber;
    private List<String> destinationNumber;
}
 

I was able to use sub dataset and list component to populate the lineItem but unable to get the list of destinationNumber inside the list.

How to display the list<String> destinationNumber in my reports.

Appreciate your help.

<subDataset name="dataset1" uuid="d0f9f7bb-3ece-4b2a-8f3d-286f16bb428c">
        <field name="lineNumber" class="java.lang.String"/>
        </subDataset>
<detail>
        <band height="25" splitType="Stretch">
            <componentElement>
                <reportElement x="4" y="0" width="548" height="20" uuid="320e66be-b719-4e1d-b1c8-9215179d7200"/>
                <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" printOrder="Vertical">
                    <datasetRun subDataset="dataset1" uuid="056d45ca-4628-4bc5-bb1f-f44bb6d74c82">
                        <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{lineDetails})]]></dataSourceExpression>
                    </datasetRun>
                    <jr:listContents height="20" width="548">
                        <textField>
                            <reportElement x="0" y="0" width="100" height="20" uuid="db39f665-58b9-43ba-89dc-0d93e2f02a77"/>
                            <textFieldExpression><![CDATA[$F{lineNumber}]]></textFieldExpression>
                        </textField>
                        
                    </jr:listContents>
                </jr:list>
            </componentElement>
        </band>
    </detail>

Appreciate your help

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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...