<div><br></div> In 5.2 this is supposed to work just fine:<div><br></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); "> CDRRecords</span><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">( calledNumber.startsWith("011") )</span></div>
<div><font class="Apple-style-span" face="arial, sans-serif"><br></font></div><div><font class="Apple-style-span" face="arial, sans-serif"> Edson<br></font><br><div class="gmail_quote">2011/8/8 Mattias Nilsson Grip <span dir="ltr"><<a href="mailto:mattias.nilsson.grip@redpill-linpro.com">mattias.nilsson.grip@redpill-linpro.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
aftab wrote:<br>
><br>
> I want to define rules for below function,<br>
><br>
> private boolean isFixedNumber(Call call){<br>
><br>
> if(call.getCalledNumber().startsWith("01") ||<br>
> call.getCalledNumber().startsWith("02") ||<br>
> call.getCalledNumber().startsWith("03") ){<br>
> return true;<br>
> }<br>
> else{<br>
> return false;<br>
> }<br>
> }<br>
><br>
> Give some hints how can i define it ?<br>
> I was trying to define it in below format,<br>
> rule "Is Fixed Number"<br>
> dialect "java"<br>
> when c : CDRRecords<br>
> (calledNumber.startsWith( "011") )<br>
> then<br>
> c.setFixedNetNumber(true);<br>
> System.out.println("c.setFixedNetNumber (true) "); // consequence<br>
><br>
> end<br>
><br>
><br>
> Thanks in advance for your support ...<br>
><br>
If you're using Drools 5.2 you should be able to do:<br>
<br>
c : CDRRecords( calledNumber str[startsWith] "011" )<br>
<br>
If you are on earlier version of Drools you can match with a regular<br>
expression:<br>
<br>
c : CDRRecords( calledNumber matches "011.*" )<br>
<br>
/Mattias<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/startsWith-function-tp3228735p3234795.html" target="_blank">http://drools.46999.n3.nabble.com/startsWith-function-tp3228735p3234795.html</a><br>
Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>
</div>