Jasper Report Crosstab with ArrayList of Data

I am trying to create Jasper Report with crosstab by writing JRXML with DTOs.

I am trying to create rows dynamic number of chargeCodes and their total. It looks something like this:

jobNo chargeCodeA chargeCodeB Total
jobNoABC 100.10 300.30 400.40
jobNoDEF 200.20 400.40 600.60

In my Java backend, I have DTO which looks like this

class MyDTO {
private String jobNo;
private List <String> chargeCode = new ArrayList <> ();
private List <BigDecimal> chargeCodeTotal = new ArrayList <> ();

where the list codeCode contains chargeCodeA, chargeCodeB for jobNoABC

and chargeCodeTotal contains 100.10, 300.30 for jobNoABC also.

In my JRXML, I have included in sample.jrxml

But I am getting error:

java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.Comparable at org.apache.commons.collections.comparators.ComparableComparator.compare(ComparableComparator.java:91)

I am not sure how to create infinite number of chargeCodes using JRXML.

And I cannot use Dynamic Jasper. I can only think of crosstab. Please help. Thanks.

alan.tham_1's picture
Joined: Sep 30 2019 - 12:29am
Last seen: 7 months 4 days ago

Did you find any solution?

mahadiosb - 9 months 4 days ago

0 Answers:

No answers yet