The rule you have shown is not capable of producing that error message. Which version of Drools are you using?<br><br>(1) You cannot use &quot;=&quot; (in: MyEvent(prop1=&quot;XYZ&quot;) to compare two values.<br>(2) You cannot use &quot;matches&quot; in eval, where Java expressions are expected (in:  eval((prop3 matches ...).<br>
(3) You must use one argument for a call to count (in: accumulate(..., count())), even though this argument does not matter.<br>(4) You should not use eval where it is not necessary.<br>(5) Your must use correct regular expressions, there is an error in: matches (&quot;MatchOne|MatchTwo){1}::&quot;+... and also in: matches &quot;(second|Third{1}_CONNECT&quot;.<br>
(6) It is highly unusual to use a repeat count of 1 for a subpattern in a regular expression.<br><br>Anyway, below is a correct version of the LHS <i><b>except for the patterns, </b></i>where I don&#39;t know what you really need to match.<br>
<br>Moreover, I urgently suggest that you<br><ul><li>DO NOT post the same question twice within 24 hours. Cleaning up the mess takes time.</li><li>Read the Drools Expert documentation before you write rules.</li><li>Start with simple conditions and test that they work.</li>
<li>Read the Drools Expert documentation.</li><li>Build and test more complex patterns once simple patterns work as expected.<br></li><li>Read the Java documentation on regular expressions.<br></li></ul>The following code has been compiled successfully using Drools 5.1.1, but some regular expressions contain errors, which will throw an exception at runtime.<br>
<br>declare MyEvent<br>  @role( event )<br>  prop1 : String<br>  prop2 : int<br>  prop3 : String<br>end<br><br>function String getFirstNameRegex(){ return &quot;blah&quot;; }<br>function String getMMSCNameRegex(){ return &quot;gaga&quot;; }<br>
function String getServerID(){ return &quot;R2D2&quot;; }<br>function int getNodeCount(){ return 20; }<br>function int getConnectionCount(){ return 20; }<br>function int getThirdNodeCount(){ return 20; }<br><br>rule &quot;or-or-or&quot;<br>
when<br>    MyEvent(prop1 == &quot;XYZ&quot;) over window:time(1m) from entry-point MyStream<br>    or<br>    ( MyEvent() over window:time(1m) from entry-point MyStream<br>      and<br>      Number($i1 : doubleValue &gt; (getNodeCount()*0.35) ) from accumulate(<br>
                       MyEvent(<br>                       prop1 == &quot;CONNECT&quot;,<br>                       prop2 == 3,<br>                       prop3 matches (&quot;match &quot; + getFirstNameRegex() + &quot; Connect&quot;)<br>
                       ) over window:time(1m) from entry-point MyStream,<br>                       count(1) )<br>    )<br>    or<br>    ( MyEvent() over window:time(1m) from entry-point MyStream<br>      and<br>      Number($i2 : doubleValue &gt; (getConnectionCount()*0.4) ) from accumulate(<br>
                       MyEvent(<br>                       prop1 matches &quot;(second|Third{1}_CONNECT&quot;,<br>                       prop2 == 1,<br>                       prop3 matches (&quot;MatchOne|MatchTwo){1}::&quot; + getMMSCNameRegex()+&quot;, failure&quot;)<br>
                       ) over window:time(1m) from entry-point MyStream,<br>                       count(1) )<br>    )<br>    or<br>    ( MyEvent() over window:time(1m) from entry-point MyStream<br>      and<br>      Number($i3 : doubleValue &gt; (getThirdNodeCount()*0.5) ) from accumulate(<br>
                       MyEvent(<br>                       prop1 matches &quot;(E1|E2){1}_CONNECT&quot;,<br>                       prop2 == 3,<br>                       prop3 matches (&quot;REPT (one|five|seven){1}::&quot; + getServerID()+&quot; is down&quot;)<br>
                       ) over window:time(1m) from entry-point MyStream,<br>                       count(1) )<br>    )<br>then<br>    System.out.println( &quot;match&quot; );<br>end<br><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
</blockquote>-W<br><br><br><br><br><div class="gmail_quote">On 28 January 2011 07:08, Ayush <span dir="ltr">&lt;<a href="mailto:ayush.vatsyayan@alcatel-lucent.com">ayush.vatsyayan@alcatel-lucent.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
When I&#39;m trying to execute multiple evals I&#39;m getting errors. Below is what<br>
I&#39;m trying to do<br>
<br>
          MyEvent(prop1=&quot;XYZ&quot;) over window:time(1m) from entry-point<br>
MyStream<br>
               or<br>
             (MyEvent() over window:time(1m) from entry-point MyStream<br>
                and<br>
                Number($i1 : doubleValue)<br>
                from accumulate(<br>
                        MyEvent(<br>
                        prop1 == &quot;CONNECT&quot;,<br>
                        prop2 == 3,<br>
                        eval((prop3 matches (&quot;match &quot;+getFirstNameRegex()+&quot;<br>
Connect&quot;)) == true)<br>
                        ) over window:time(1m) from entry-point MyStream,<br>
count()<br>
                )<br>
                and<br>
                eval($i1 &gt; getNodeCount()*0.35))<br>
        or<br>
                (MyEvent() over window:time(1m) from entry-point MyStream<br>
                and<br>
                Number($i2 : doubleValue)<br>
                from accumulate(<br>
                        MyEvent(<br>
                        prop1 matches &quot;(second|Third{1}_CONNECT&quot;,<br>
                        prop2 == 1,<br>
                        eval((prop3 matches<br>
(&quot;MatchOne|MatchTwo){1}::&quot;+getMMSCNameRegex()+&quot;, failure&quot;)) == true)<br>
                        ) over window:time(1m) from entry-point MyStream,<br>
count()<br>
                )<br>
                and<br>
                eval($i2 &gt; getConnectionCount()*0.4))<br>
        or<br>
                (MyEvent() over window:time(1m) from entry-point MyStream<br>
                and<br>
                Number($i3 : doubleValue)<br>
                from accumulate(<br>
                        MyEvent(<br>
                        prop1 matches &quot;(E1|E2){1}_CONNECT&quot;,<br>
                        prop2 == 3,<br>
                        eval((prop3 matches (&quot;REPT (one|five|seven){1}::<br>
&quot;+getServerID()+&quot; is down&quot;)) == true)<br>
                        ) over window:time(1m) from entry-point MyStream,<br>
count()<br>
                )<br>
                and<br>
                eval($i3 &gt; getThirdNodeCount()*0.5))<br>
<br>
When I&#39;m trying to execute the above LHS I get<br>
org.drools.rule.InvalidPatternException: Required Declarations not bound:<br>
&#39;$i1&#39;.<br>
<br>
I even tried using below approach<br>
<br>
       AlertReceivedEvent() over window:time(1m) from entry-point<br>
NotificationStream<br>
<br>
                $I1 : Double() from getIsgNodeCount()<br>
<br>
                Number(doubleValue &gt; $I1) from accumulate(<br>
                        AlertReceivedEvent(<br>
                                entity == &quot;NPMMS_NE_CONNECT&quot;,<br>
                                probableCause == 3,<br>
                                eval((specificProblems matches (&quot;REPT ISG<br>
NPMMS::Unable to connect to &quot;+getPxmmsNameRegex()+&quot; node: PXMMS&quot;)) == true)<br>
                        ) over window:time(1m) from entry-point<br>
NotificationStream, count()<br>
                )<br>
<br>
<br>
But when I&#39;m placing parentheses () around it, it throws exception stating<br>
mismatched input &#39;$I1&#39; expecting &#39;)&#39; in rule. For now I&#39;d placed these 3<br>
statements in separate rules. Can anyone please help me solving it?  Thanks<br>
in advance.<br>
<font color="#888888">--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Problem-implementing-multiple-evals-tp2365761p2365761.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Problem-implementing-multiple-evals-tp2365761p2365761.html</a><br>

Sent from the Drools - User 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>