Jump to content

Jasper Report Crosstab with ArrayList of Data


alan.tham_1

Recommended Posts

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:

jobNochargeCodeAchargeCodeBTotal
jobNoABC100.10300.30400.40
jobNoDEF200.20400.40600.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 <> ();}[/code]

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.

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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