In 5.2 this is supposed to work just fine:
CDRRecords( calledNumber.startsWith("011") )
Edson
2011/8/8 Mattias Nilsson Grip
<mattias.nilsson.grip@redpill-linpro.com>
aftab wrote:
>
> I want to define rules for below function,
>
> private boolean isFixedNumber(Call call){
>
> if(call.getCalledNumber().startsWith("01") ||
> call.getCalledNumber().startsWith("02") ||
> call.getCalledNumber().startsWith("03") ){
> return true;
> }
> else{
> return false;
> }
> }
>
> Give some hints how can i define it ?
> I was trying to define it in below format,
> rule "Is Fixed Number"
> dialect "java"
> when c : CDRRecords
> (calledNumber.startsWith( "011") )
> then
> c.setFixedNetNumber(true);
> System.out.println("c.setFixedNetNumber (true) "); // consequence
>
> end
>
>
> Thanks in advance for your support ...
>
If you're using Drools 5.2 you should be able to do:
c : CDRRecords( calledNumber str[startsWith] "011" )
If you are on earlier version of Drools you can match with a regular
expression:
c : CDRRecords( calledNumber matches "011.*" )
/Mattias
--
View this message in context: http://drools.46999.n3.nabble.com/startsWith-function-tp3228735p3234795.html
Sent from the Drools: User forum 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
JBoss by Red Hat @
www.jboss.com