Hi Bill,<br><br>To implement your rules in 3.0.5 you would need to implement a rule for each combination of age and zipCode.<br><br>$a : Person(age > 35 zipCode == 23546)<br>then<br>$a.setStatus("KT");<br><br>
$a : Person(age < 25, zipCode == 23546 )<br>then<br>$a.setStatus("KT");<br><br>$a : Person(age > 35, zipCode == 68590)<br>then<br>$a.setStatus("KT");<br><br>etc..<br><br>Steve<br><br><div><span class="gmail_quote">
On 2/19/07, <b class="gmail_sendername">Bill Zhang</b> <<a href="mailto:billzhang2006@gmail.com">billzhang2006@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
So Alex, if I only want to use the old syntax that is in production,<br>there is no way to implement my seemingly simple logic conditioning?<br><br>Thanks for your help.<br><br>On 2/18/07, Alexander Varakin <<a href="mailto:avarakin@optonline.net">
avarakin@optonline.net</a>> wrote:<br>> As far as I know this syntax is new and is available in SVN only, you<br>> will have to wait till 3.1 is released or take source from SVN and build it.<br>><br>> Bill Zhang wrote:
<br>> > Hi Steven,<br>> ><br>> > Thank you very much for your help. Really appreciate.<br>> ><br>> > I still got the same error, Unexpected token '|'. I did not see "|" in<br>
> > the document, only saw "||", which is supposed to be used with<br>> > columns.<br>> ><br>> > Ye<br>> ><br>> > On 2/18/07, Steven Williams <<a href="mailto:stevenw@objectconsulting.com.au">
stevenw@objectconsulting.com.au</a>> wrote:<br>> >> Hi Bill,<br>> >><br>> >> I think it should be:<br>> >><br>> >> $a : Person(age > 35 | < 25, zipCode == 23546 | == 68590)
<br>> >><br>> >> Edson, Mark or Michael can probably confirm or correct the above syntax.<br>> >><br>> >> Make sure you are running of the latest trunk.<br>> >><br>> >> cheers
<br>> >> Steve<br>> >><br>> >><br>> >> On 2/18/07, Bill Zhang <<a href="mailto:billzhang2006@gmail.com">billzhang2006@gmail.com</a>> wrote:<br>> >> ><br>> >> > I tried:
<br>> >> ><br>> >> > $a : Person(age > 35 || age < 25, zipCode == 23546 || == 68590)<br>> >> ><br>> >> > Errors:<br>> >> > org.drools.rule.InvalidRulePackage
: unknown:39:30<br>> >> Unexpected token '||'<br>> >> > unknown:39:40 mismatched token:<br>> >> [@246,1040:1041='<=',<47>,39:40];<br>> >> > expecting type '('
<br>> >> > unknown:39:92 mismatched token:<br>> >> [@258,1092:1092='<',<46>,39:92];<br>> >> > expecting type '('<br>> >> ><br>> >> > I also tried
<br>> >> ><br>> >> > $a : Person(age > 35 | age < 25, zipCode == 23546 | == 68590)<br>> >> ><br>> >> > Pretty much the same error.<br>> >> ><br>> >> > Based on the document, "||" is only valid for columns...
<br>> >> ><br>> >> ><br>> >> > On 2/17/07, Bill Zhang <<a href="mailto:billzhang2006@gmail.com">billzhang2006@gmail.com</a>> wrote:<br>> >> > > Thank you Steve. But I got syntax error using the following.
<br>> >> > ><br>> >> > > On 2/17/07, Steven Williams <<a href="mailto:stevenw@objectconsulting.com.au">stevenw@objectconsulting.com.au</a>> wrote:<br>> >> > > > In trunk I think you can use connective constraints:
<br>> >> > > ><br>> >> > > > $a : Person(age > 35 | < 25, zipCode == 23546 | == 68590)<br>> >> > > > then<br>> >> > > > $a.setStatus("KT");
<br>> >> > > ><br>> >> > > ><br>> >> > > ><br>> >> > > ><br>> >> > > > On 2/18/07, Bill Zhang < <a href="mailto:billzhang2006@gmail.com">
billzhang2006@gmail.com</a>> wrote:<br>> >> > > > ><br>> >> > > > > Hello,<br>> >> > > > ><br>> >> > > > > I am a new Drools user trying to convert the following simple
<br>> >> logic<br>> >> into<br>> >> > > > DRL:<br>> >> > > > ><br>> >> > > > > IF (Person.Age > 35 OR Person.Age < 25) AND (Person.ZipCode
=<br>> >> 23546<br>> >> or<br>> >> > > > > Person.ZipCode = 68590)<br>> >> > > > > THEN<br>> >> > > > > Person.Status = "KT";<br>
> >> > > > ><br>> >> > > > > I found that it is not easy to convert the above logic into<br>> >> ONE DRL<br>> >> rule.<br>> >> > > > ><br>> >> > > > > I tried something like this
<br>> >> > > > ><br>> >> > > > > when<br>> >> > > > > $a: Person(age>35) or Person (age<25)<br>> >> > > > > $b: Person(Zipcode==23456) or Person (ZipCode == 68590)
<br>> >> > > > > $c: $a and $b<br>> >> > > > > Then<br>> >> > > > > $c.setStatus("KT")<br>> >> > > > ><br>> >> > > > > But looks like I can not use
<br>> >> > > > > $c: $a and $b<br>> >> > > > > becaue in Drools, you can only bind variable to column, not<br>> >> to other<br>> >> > > > varaibles.<br>
> >> > > > ><br>> >> > > > > Please advise how to do this. I would imagine this should be<br>> >> quite<br>> >> > > > > simple, maybe I missed something quite obvious.
<br>> >> > > > ><br>> >> > > > > I know that I can write custom Java method to do this, but if<br>> >> I do<br>> >> > > > > that, I suppose I lose the power of RETEOO pattern matching
<br>> >> (pattern<br>> >> > > > resuing,<br>> >> > > > > etc.). So I prefer not to do that.<br>> >> > > > ><br>> >> > > > > I also understand I can break the above logic into 4 rules
<br>> >> and that<br>> >> > > > > would be quite easy, but our business user is not used to<br>> >> think in<br>> >> > > > > that way. Also, we have more complex logic than the above. So
<br>> >> what I<br>> >> > > > > want is to see if there is a way to convert this<br>> >> > > > > kind of logic in ONE DRL rule.<br>> >> > > > ><br>> >> > > > > Thanks in advance.
<br>> >> > > > ><br>> >> > > > > Bill<br>> >> > > > > _______________________________________________<br>> >> > > > > rules-users mailing list
<br>> >> > > > > <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>> >> > > > ><br>> >> <a href="https://lists.jboss.org/mailman/listinfo/rules-users">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br>> >> > > > ><br>> >> > > ><br>> >> > > ><br>> >> > > ><br>> >> > > > --
<br>> >> > > > Steven Williams<br>> >> > > ><br>> >> > > > Supervising Consultant<br>> >> > > ><br>> >> > > > Object Consulting<br>
> >> > > > Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501<br>> >> > > > <a href="mailto:stevenw@objectconsulting.com.au">stevenw@objectconsulting.com.au</a><br>> >> > > >
<a href="http://www.objectconsulting.com.au">www.objectconsulting.com.au</a><br>> >> > > ><br>> >> > > > consulting | development | training | support<br>> >> > > > our experience makes the difference
<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">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>> >> > > ><br>> >> > > ><br>
> >> > ><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">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>> >> ><br>> >><br>> >><br>> >><br>
> >> --<br>> >> Steven Williams<br>> >><br>> >> Supervising Consultant<br>> >><br>> >> Object Consulting<br>> >> Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
<br>> >> <a href="mailto:stevenw@objectconsulting.com.au">stevenw@objectconsulting.com.au</a><br>> >> <a href="http://www.objectconsulting.com.au">www.objectconsulting.com.au</a><br>> >><br>> >> consulting | development | training | support
<br>> >> our experience makes the difference<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">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>> >><br>> >><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">https://lists.jboss.org/mailman/listinfo/rules-users
</a><br>> ><br>><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">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br>><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">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></div><br><br clear="all"><br>-- <br>Steven Williams<br><br>Supervising Consultant
<br><br>Object Consulting<br>Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501<br><a href="mailto:stevenw@objectconsulting.com.au">stevenw@objectconsulting.com.au</a><br><a href="http://www.objectconsulting.com.au">www.objectconsulting.com.au
</a><br><br>consulting | development | training | support<br>our experience makes the difference