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><div><span class="gmail_quote">On 2/18/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;">
I tried:<br><br>$a : Person(age > 35 || age < 25, zipCode == 23546 || == 68590)<br><br>Errors:<br>org.drools.rule.InvalidRulePackage: unknown:39:30 Unexpected token '||'<br>unknown:39:40 mismatched token: [@246,1040:1041='<=',<47>,39:40];
<br>expecting type '('<br>unknown:39:92 mismatched token: [@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 logic into
<br>> > DRL:<br>> > ><br>> > > IF (Person.Age > 35 OR Person.Age < 25) AND (Person.ZipCode = 23546 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 ONE DRL 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 to other<br>> > varaibles.<br>> > >
<br>> > > Please advise how to do this. I would imagine this should be 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 I do
<br>> > > that, I suppose I lose the power of RETEOO pattern matching (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 and that
<br>> > > would be quite easy, but our business user is not used to think in<br>> > > that way. Also, we have more complex logic than the above. So 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>> > > <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></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