Sven
Sven

Reputation: 952

How use a parameter as datasource in Jasper list element?

I have a report template where a parameter is defined as:

<parameter name="phonenumbers" class="java.util.List"/>

Those phonenumbers are objects of type:

se.primenta.data.entity.PhoneNumber

and these objects have two methods that I need present in the report:

String getMaskedNumber();
Long getNumber;

I can't understand how to get these two fields into a subDataset that can be visualized in a List element. How do I write the dataset and the list definitition in the JRXML template?

Upvotes: 1

Views: 3784

Answers (1)

Miguel Rivero
Miguel Rivero

Reputation: 1466

What about having a Datasource for the list like :

<dataSourceExpression>
<![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{phonenumbers})]]>           
</dataSourceExpression>

And then using $F{maskedNumber} and $F{number}

inside the list ?

Upvotes: 5

Related Questions