Steve,

   Only way to do that today is through in-line eval().
   Although it is quite easy to add such support to drools, in case you want to help providing us a patch. Probably 3-4 hours work. Just a matter of adding the operator support in this class:

http://anonsvn.labs.jboss.com/labs/jbossrules/branches/4.0.x/drools-core/src/main/java/org/drools/base/evaluators/StringFactory.java

    And unit tests in this class:

http://anonsvn.labs.jboss.com/labs/jbossrules/branches/4.0.x/drools-core/src/test/java/org/drools/base/EvaluatorFactoryTest.java

   Everything else should work just fine and then your rules will be able to use <, >, etc directly for String comparisons.

   []s
   Edson


2008/5/6 Steve Olson <SOlson@ameren.com>:

We've hit a situation where the business users would like to specifiy some
facts that have a range check (a 'between' type operation) on fixed length
strings, that are usually short (6 characters or less).  Simple example -
given a range of 'ABC' to 'ABM', this range would match all the character
strings 'ABC', 'ABD', ..., 'ABM'.  We quickly discovered the '<' and '>'
operators don't work with strings, and are wondering if others have solved
this problem other ways.  Searches have shown some discussions about being
able to build something like a custom StringEvaluator that does support '<'
and '>', but we haven't seen enough to know what would be the best path.  If
anyone has suggestions, other than using eval() for all such checks, I'd
appreciate any info.

Thanks in advance...
--
View this message in context: http://www.nabble.com/String-range-compares-tp17085898p17085898.html
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
Edson Tirelli
JBoss Drools Core Development
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @ www.jboss.com