How print a array in jasper ?

Hi, I need help, I am sending the parameter in array, to printed in the report the problem is:

It is printed like this:

And I need to print like this, like a table:


I don't use a query to send the parameters, I sending for a array using a framework in php, is just a test to implement in a real report, I just need know how I can do that, someone can help ?

gabriel.nadoroski's picture
Joined: Oct 1 2018 - 2:05pm
Last seen: 4 years 3 months ago

Thanks reportdev!

You saved me, I giving up doing of make the report in jaspersoft

But you saved me, your answer helped me.

gabriel.nadoroski - 4 years 5 months ago

3 Answers:

you need to convert the List to JRBeanCollectionDataSource in order for it to iterate and use a List element

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version using JasperReports Library version 6.4.1  -->
<jasperReport xmlns="" xmlns:xsi="" xsi:schemaLocation="" name="Iterator" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="20f55d6a-1496-430d-8dde-cdb41d7b53ac">
    <property name="" value="One Empty Record"/>
    <subDataset name="Dataset1" uuid="a32a36ba-2e14-4071-9649-c5738d43e63a">
        <field name="_THIS" class="java.lang.String"/>
    <parameter name="arrayAccepter" class="java.util.List">
        <defaultValueExpression><![CDATA[Arrays.asList("Hello1", "Hello2", "Hello3", "Hello4")]]></defaultValueExpression>
        <band splitType="Stretch"/>
        <band height="90">
                <reportElement x="0" y="0" width="290" height="30" uuid="5208b9c8-6128-4f52-90de-7d93bbd0294e"/>
                <reportElement x="0" y="60" width="100" height="30" uuid="b014b59d-186c-42cd-b975-a7a1ca18ca9f"/>
                <jr:list xmlns:jr="" xsi:schemaLocation="">
                    <datasetRun subDataset="Dataset1" uuid="b3c55d8f-90d9-4ddc-9fa1-66da2cb48783">
                    <jr:listContents height="30" width="100">
                            <reportElement x="0" y="0" width="100" height="30" uuid="c6bd4e2a-e756-4089-bdf7-9b06b5575201"/>

reportdev's picture
Joined: Oct 12 2015 - 12:05pm
Last seen: 9 months 1 week ago

If your need is to remove square brackets I think below should be of help

sadakar's picture
Joined: Aug 14 2012 - 3:57am
Last seen: 5 months 1 week ago

Thanks !

This helpful, but I need broke him in lines, like a table in execl.
Let's see, I think this can help you understand my problem.

I am doing a query in PHP in the database, that query brings to me a quantity of payments and the date of this payments, and I need to make a table with that data in xls.

gabriel.nadoroski's picture
Joined: Oct 1 2018 - 2:05pm
Last seen: 4 years 3 months ago