Jump to content

Comparator exp.


dman

Recommended Posts

Hi all,

 

I’d like to use a comparator expression in order to sort the rows in a crosstab.

 

The bucket exp. is $P{IP} which is a string specifying an IP.

Since the order is wrong if I use the original IP to sort (e.g. “139.2.51.74” is displayed after “139.2.51.233”) I want to use a hexadecimal representation of the IP - $P{IPHEX} ( “8b02334a” is correctly displayed before “8b0233e9”).

 

If anybody finds a way out how to use the Comparator exp. in this case, please share,

 

regards,

DM

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

  • 1 year later...

create a class which implements java.util.Comparator

package com.example;

public class CustomComparator implements Comparator {

         public int compare(elem1<Type> , ele2<Type2>) {

                      // write logic to return  -1,0,1

         }

}

 

write CompartorExpression as 

"new com.example.CustomComparator()"

 

 

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