Skip to Content
Feb 13, 2012 at 10:05 AM

Comparison operators startsWith, endsWith ?



it would be helpful to have the predefined comparison operators starts with and ends with.

I know that this is only a small thing and could easily be worked around with the CP operator, like this

contains pattern "STRING*"


contains pattern "*STRING"

but it would improve the readabilty of the rules to have these operators built-in, in particular if the STRING is not a literal but a variable which has to be manipulated first in a separate, purely technical step.

In my example, I have a string representing the product hierarchy, and the first two digits representing the top level of the hierarchy, called "Bedarfsbereich". The rule has to check whether the actual product hierarchy value fits into this "Bedarfsbereich". Both data objects, product hierarchy and "Bedarfsbereich", are data objects, not constants, in my rule - coming in as import parameters.

I am currently working with a custom formula function to meet this case.

By the way: Would it be possible to define custom comparison operators?