OK, Ignore this one as well. It looks like the syntax changed slight from the blog entry. The connector for the fields is || versus the single | in the blog.<br><br>Thanks!<br><br><div><span class="gmail_quote">On 7/7/07,
<b class="gmail_sendername">Ronald R. DiFrango</b> <<a href="mailto:ron.difrango@gmail.com">ron.difrango@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;">
And it looks like the != operator is not allowed either:<span class="q"><br><br>rtvHeader : RtvHeader( status != "Matched" | != "Approval" )<br><br></span>Does not work<div><span class="e" id="q_113a15777dbaf22c_3">
<br><br><div><span class="gmail_quote">On 7/7/07, <b class="gmail_sendername">
Ronald R. DiFrango</b> <<a href="mailto:ron.difrango@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">ron.difrango@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;">
OK, here is the problem:<br><br>I currently have this:<span><br><br>rtvHeader : RtvHeader( status != StatusConstants.MATCHED | != StatusConstants.APPROVAL )<br><br></span>but if I switch it to use a quoted string value like the following:
<br><br>rtvHeader : RtvHeader( status == "Matched" | == "Approval" )<br><br>It works...Is this a bug?<div><span><br><br><div><span class="gmail_quote">On 7/7/07, <b class="gmail_sendername">
Ronald R. DiFrango</b>
<<a href="mailto:ron.difrango@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">ron.difrango@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;">
OK, this does not looked correct syntax or that it is supported. Here is the exception I get:
<br><br>Exception in thread "main" java.lang.ExceptionInInitializerError<br> at com.circuitcity.rtvcrms.test.MainBasedTester.testRules
(MainBasedTester.java:31)<br> at com.circuitcity.rtvcrms.test.MainBasedTester.main(MainBasedTester.java:23)<br>Caused by: java.lang.RuntimeException: Failure loading the Rules<br> at com.circuitcity.rtvcrms.rules.RtvDecisionEngine
.<clinit>(RtvDecisionEngine.java:48)<br> ... 2 more<br>Caused by: org.drools.rule.InvalidRulePackage: [22,59]: unknown:22:59 Unexpected token '|'[22,89]: unknown:22:89 mismatched token: [@162,707:707=')',<13>,22:89]; expecting type LEFT_PAREN[33,59]: unknown:33:59 Unexpected token '|'[33,89]: unknown:33:89 mismatched token: [@263,1112:1112=')',<13>,33:89]; expecting type LEFT_PAREN[44,59]: unknown:44:59 Unexpected token '|'[44,89]: unknown:44:89 mismatched token: [@364,1510:1510=')',<13>,44:89]; expecting type LEFT_PAREN[55,59]: unknown:55:59 Unexpected token '|'[55,89]: unknown:55:89 mismatched token: [@465,1924:1924=')',<13>,55:89]; expecting type LEFT_PAREN
<br> at org.drools.rule.Package.checkValidity(Package.java:409)<br> at org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:262)<br> at com.circuitcity.rtvcrms.rules.RtvDecisionEngine.<clinit>(
RtvDecisionEngine.java:44)<br> ... 2 more<br><br>And here is my rules:<br><br>#created on: Jul 7, 2007<br>package com.circuitcity.rtvcrms.rules<br><br>#list any import classes here.<br>import java.math.BigDecimal;<br>
import
java.math.BigInteger;<br><br>import com.circuitcity.rtvcrms.bw.Constants;<br>import com.circuitcity.rtvcrms.bw.DocumentTypes;<br>import com.circuitcity.rtvcrms.bw.StatusConstants;<br><br>import com.circuitcity.rtvcrms.EffectivePrice
;<br>import com.circuitcity.rtvcrms.RtvHeader;<br><br><br>#declare any global variables here<br><br>rule "Line Set Open #1"<br> salience -10<br> when<br> rtvDetailLine : DetailLine(rtvNumber != null, rtvNumber == cmRtvNumber, lineNumber != null, status ==
StatusConstants.OPEN)<br> rtvHeader : RtvHeader( status == StatusConstants.MATCHED | == StatusConstants.APPROVAL )<br> then <br> System.out.println("Line Set Open #1");<br> rtvHeader.setStatus
(StatusConstants.PARTIALLY_MATCHED);<br> update(rtvHeader);<br>end<br><br>rule "Line Set Open #2"<br> salience -10<br> when<br> rtvDetailLine : DetailLine(rtvNumber != null, rtvNumber == cmRtvNumber, lineNumber != null, status ==
StatusConstants.OPEN)<br> rtvHeader : RtvHeader( status != StatusConstants.MATCHED | != StatusConstants.APPROVAL )<br> then<br> System.out.println("Line Set Open #2"); <br> rtvHeader.setStatus
(StatusConstants.OPEN);<br> update(rtvHeader);<br>end<br><br>rule "Line Set Matched #1"<br> salience -10<br> when<br> rtvDetailLine : DetailLine(rtvNumber != null, rtvNumber == cmRtvNumber, lineNumber != null, status ==
StatusConstants.MATCHED)<br> rtvHeader : RtvHeader( status != StatusConstants.MATCHED | != StatusConstants.APPROVAL )<br> then <br> System.out.println("Line Set Matched #1");<br> rtvHeader.setStatus
(StatusConstants.PARTIALLY_MATCHED);<br> update(rtvHeader);<br>end<br><br>rule "Line Set Matched #2"<br> salience -10<br> when<br> rtvDetailLine : DetailLine(rtvNumber != null, rtvNumber == cmRtvNumber, lineNumber != null, status ==
StatusConstants.MATCHED)<br> rtvHeader : RtvHeader( status == StatusConstants.MATCHED | == StatusConstants.APPROVAL )<br> then <br> System.out.println("Line Set Matched #2");<br> rtvHeader.setStatus
(StatusConstants.MATCHED);<br> update(rtvHeader);<br>end<br><br>rule "Line Set Approval #1"<br> salience -10<br> when<br> rtvDetailLine : DetailLine(rtvNumber != null, rtvNumber == cmRtvNumber, lineNumber != null, status ==
StatusConstants.APPROVAL)<br> rtvHeader : RtvHeader( status == StatusConstants.MATCHED )<br> then <br> System.out.println("Line Set Approval #1");<br> rtvHeader.setStatus(StatusConstants.APPROVAL
);<br> update(rtvHeader);<br>end<br><br>rule "Line Set Approval #2"<br> salience -10<br> when<br> rtvDetailLine : DetailLine(rtvNumber != null, rtvNumber == cmRtvNumber, lineNumber != null, status ==
StatusConstants.APPROVAL)<br> rtvHeader : RtvHeader( status == StatusConstants.OPEN )<br> then <br> System.out.println("Line Set Approval #2");<br> rtvHeader.setStatus(StatusConstants.PARTIALLY_MATCHED
);<br> update(rtvHeader);<br>end<br><br>rule "Line Set Approval #3"<br> salience -10<br> when<br> rtvDetailLine : DetailLine(rtvNumber != null, rtvNumber == cmRtvNumber, lineNumber != null, status ==
StatusConstants.APPROVAL)<br> rtvHeader : RtvHeader( status != StatusConstants.OPEN )<br> then <br> System.out.println("Line Set Approval #3");<br> rtvHeader.setStatus(StatusConstants.PARTIALLY_MATCHED
);<br> update(rtvHeader);<br>end<br><br><br>As another note, the JBoss Rules IDE is NOT reporting any errors with the syntax.<div><span><br><br><div><span class="gmail_quote">On 7/7/07,
<b class="gmail_sendername">Ronald R. DiFrango
</b> <<a href="mailto:ron.difrango@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">ron.difrango@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;">
Answered my own question:<br><br>MyObject (status == StatusConstants.MATCHED | == StatusConstants.APPROVAL)<div><span><br><br><div><span class="gmail_quote">On 7/7/07, <b class="gmail_sendername">
Ronald R. DiFrango</b> <<a href="mailto:ron.difrango@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
ron.difrango@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;">All,<br><br>If I remember correctly, in the 4.x
version of Drools you were adding an or type syntax where you could compare a value against multiple values. What is the new syntax for it?
<br><br>I am looking to do something logically like:
<br><br>MyObject (status in ("Open" or "Matched")<br><br>Ron<br>
</blockquote></div><br>
</span></div></blockquote></div><br>
</span></div></blockquote></div><br>
</span></div></blockquote></div><br>
</span></div></blockquote></div><br>