cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Class Comparator, Property Metadata, Sorting of Currency Values

Former Member
0 Kudos

I have setup a custom, predefined KM property that contains a currency value. I want the value to sort as a numeric value, rather than a string.

I have tried to implement a custom Comparator Class, by extending the class ResourcePropertyComparator. This is similar to the SAP class DefaultResourcePropertyComparator.

I then added the fully defined class name to the configuration field for Class Comparator in the Property Metadata. I also tried various other options, including removing the package name, etc.

When a sort is attempted, it appears as if the SAP code cannot find my new class. It throws the following exception:

java.lang.NullPointerException: Could not create a valid Comparator instance for the given metaname serco_transactions:serco_invoice_amount_due

at com.sapportals.wcm.rendering.collection.DefaultResourcePropertyComparator.setComparator(DefaultResourcePropertyComparator.java:52)

What am I doing wrong? How can I implement the custom comparator properly?

Thanks.

Bill

Accepted Solutions (0)

Answers (1)

Answers (1)

die_ste
Advisor
Advisor
0 Kudos

Hi Bill,

Try to implement the IResourcePropertyComparator interface:

import com.sapportals.wcm.service.propertyconfig.comparator.IResourcePropertyComparator;
public class MyCurrencyComparator implements IResourcePropertyComparator {
...
}

Regards,

Dietmar