dman Posted April 8, 2009 Share Posted April 8, 2009 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 More sharing options...
Giulio Toffoli Posted April 8, 2009 Share Posted April 8, 2009 You just have to specify a class that implements the interfaceGiuliojava.util.Comparator Link to comment Share on other sites More sharing options...
dman Posted April 9, 2009 Author Share Posted April 9, 2009 could someone post a simple example please? Link to comment Share on other sites More sharing options...
sunilkumar92097 Posted September 6, 2010 Share Posted September 6, 2010 create a class which implements java.util.Comparatorpackage 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now