Jump to content
We've recently updated our Privacy Statement, available here ×

Comparator expression on crosstab ??


jbo_master

Recommended Posts

hello all,

Is it right that we can override the sorting order of a row or column group of a crosstab by a comparator expression?

If we can,
does anyone of you guys have an working example of such a "comparator expression"?

Thanks for your help


 

 

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • 3 months later...

had exactly the same problem.

Found a 'quite hacky' solution using a Comparator and an Object[] as expression (see code)

and use:

"((Object[])$V{"+nameOfYourRowGroup+"})[0]"

as the expression text of your header Cell.

hope you got the idea,

regards

Dieter

 

Code:
JRDesignCrosstabBucket bucket = new JRDesignCrosstabBucket();JRDesignExpression orderComparator = new JRDesignExpression();orderComparator.setValueClass(Comparator.class);orderComparator.setText("$P{Comparator}.getComparator()"); // or new MyComparator() ...bucket.setComparatorExpression(orderComparator);rowExpression.setText("new Object[] {$F{"+yourValueToDisplay+"}, $F{"+yourValueToOrder+"}}");rowExpression.setValueClass(Object.class);
Link to comment
Share on other sites

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