<br>&nbsp;&nbsp;&nbsp; It is not possible to assign the result of an arbitrary method call to a variable right now. So, your best option is probably to do (please note the use of inline-eval):<br><br><p style=""><b><font color="#960000" face="Courier New" size="2">
<span style="font-size: 10pt; color: rgb(150, 0, 0); font-weight: bold;">rule</span></font></b><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;"> </span></font><font color="green" face="Courier New" size="2">
<span style="font-size: 10pt; color: green;">&quot;SupplierView:
Headquarter Supplier Code should end on 25 or 30.&quot;</span></font></p>



<p style=""><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></font><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(150, 0, 0); font-weight: bold;">
when</span></font></b></p>



<p style=""><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $cs : SupplierView(corporate == </span></font><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(150, 0, 0); font-weight: bold;">
true,</span></font></b><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;"> eval( </span></font><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">
suppCode.substring(4, 6).equals( </span></font><font color="green" face="Courier New" size="2"><span style="font-size: 10pt; color: green;">&quot;25&quot; )</span></font><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">
 || suppCode.substring(4, 6).equals( </span></font><font color="green" face="Courier New" size="2"><span style="font-size: 10pt; color: green;">&quot;30&quot; ) ) )<br>
</span></font></p>

<p style=""><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></font><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(150, 0, 0); font-weight: bold;">
then</span></font></b></p>



<p style=""><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ValidationErrorFacade.getInstance().registerError($cs,
</span></font><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(150, 0, 0); font-weight: bold;">new</span></font></b><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">

ValidationError(</span></font><font color="green" face="Courier New" size="2"><span style="font-size: 10pt; color: green;">&quot;Headquarter
Supplier Code should end on 25 or 30.&quot;</span></font><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">));</span></font></p>



<p style=""><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(150, 0, 0); font-weight: bold;">end</span></font></b></p>



<font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"></span></font><br>&nbsp;&nbsp;&nbsp; A more clean solution is to use &quot;matches&quot; operator. If your rule states that Supplier Code must END with 25 or 30, you can do:
<br><br><p style=""><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(150, 0, 0); font-weight: bold;">rule</span></font></b><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">
 </span></font><font color="green" face="Courier New" size="2"><span style="font-size: 10pt; color: green;">&quot;SupplierView:
Headquarter Supplier Code should end on 25 or 30.&quot;</span></font></p>


<p style=""><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></font><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(150, 0, 0); font-weight: bold;">
when</span></font></b></p>


<p style=""><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $cs : SupplierView(corporate == </span></font><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(150, 0, 0); font-weight: bold;">
true,</span></font></b><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;"> </span></font><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">
suppCode matches </span></font><font color="green" face="Courier New" size="2"><span style="font-size: 10pt; color: green;">&quot;.*25&quot; </span></font><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">
|| matches </span></font><font color="green" face="Courier New" size="2"><span style="font-size: 10pt; color: green;">&quot;.*30&quot; )<br>
</span></font></p>
<p style=""><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></font><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(150, 0, 0); font-weight: bold;">
then</span></font></b></p>


<p style=""><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ValidationErrorFacade.getInstance().registerError($cs,
</span></font><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(150, 0, 0); font-weight: bold;">new</span></font></b><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">

ValidationError(</span></font><font color="green" face="Courier New" size="2"><span style="font-size: 10pt; color: green;">&quot;Headquarter
Supplier Code should end on 25 or 30.&quot;</span></font><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">));</span></font></p>


<p style=""><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(150, 0, 0); font-weight: bold;">end</span></font></b></p>


<font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"></span></font><br>&nbsp;&nbsp;&nbsp; Hope it helps.<br><br>&nbsp;&nbsp;&nbsp; []s<br>&nbsp;&nbsp;&nbsp; Edson<br><br><br><div><span class="gmail_quote">2007/7/12, Manukyan, Sergey &lt;
<a href="mailto:SManukyan@lear.com">SManukyan@lear.com</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">








<div link="blue" vlink="blue" lang="EN-US">

<div>

<p style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Folks,</span></font></p>

<p style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;</span></font></p>

<p style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">I have a rule where I am repeating
part of it twice : (</span></font><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">$cs.getSuppCode().substring(4,
6)</span></font><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">), and I would like to replace it with variable… how
can I do that? The solution with "in" doesn't worl because it
is a java code needed to perform calculations for variable…..</span></font></p>

<p style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">&nbsp;</span></font></p>

<p style=""><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Please see the rule below:</span></font></p>

<p style=""><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(150, 0, 0); font-weight: bold;">&nbsp;</span></font></b></p>

<p style=""><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(150, 0, 0); font-weight: bold;">rule</span></font></b><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">
 </span></font><font color="green" face="Courier New" size="2"><span style="font-size: 10pt; color: green;">&quot;SupplierView:
Headquarter Supplier Code should end on 25 or 30.&quot;</span></font></p>

<p style=""><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></font><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(150, 0, 0); font-weight: bold;">
when</span></font></b></p>

<p style=""><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $cs : SupplierView(corporate == </span></font><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(150, 0, 0); font-weight: bold;">
true</span></font></b><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">)</span></font></p>

<p style=""><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></font><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(150, 0, 0); font-weight: bold;">
eval</span></font></b><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">($cs.getSuppCode().substring(4, 6) == </span></font><font color="green" face="Courier New" size="2"><span style="font-size: 10pt; color: green;">
&quot;25&quot;</span></font><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;"> || $cs.getSuppCode().substring(4, 6) == </span></font><font color="green" face="Courier New" size="2">
<span style="font-size: 10pt; color: green;">&quot;30&quot;</span></font><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">) </span></font></p>

<p style=""><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></font><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(150, 0, 0); font-weight: bold;">
then</span></font></b></p>

<p style=""><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ValidationErrorFacade.getInstance().registerError($cs,
</span></font><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(150, 0, 0); font-weight: bold;">new</span></font></b><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">

ValidationError(</span></font><font color="green" face="Courier New" size="2"><span style="font-size: 10pt; color: green;">&quot;Headquarter
Supplier Code should end on 25 or 30.&quot;</span></font><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; color: black;">));</span></font></p>

<p style=""><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; color: rgb(150, 0, 0); font-weight: bold;">end</span></font></b></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Thanks,</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">-Sergey</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">&nbsp;</span></font></p>

</div>

</div>



<table><tbody><tr><td bgcolor="#ffffff"><font color="#000000">**********************<br>
** LEGAL DISCLAIMER **<br>
**********************<br>
<br>
This E-mail message and any attachments may contain <br>
legally privileged, confidential or proprietary <br>
information. If you are not the intended recipient(s),<br>
or the employee or agent responsible for delivery of <br>
this message to the intended recipient(s), you are <br>
hereby notified that any dissemination, distribution <br>
or copying of this E-mail message is strictly <br>
prohibited. If you have received this message in <br>
error, please immediately notify the sender and <br>
delete this E-mail message from your computer.<br>
</font></td></tr></tbody></table><br>_______________________________________________<br>rules-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org
</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br></blockquote></div>
<br><br clear="all"><br>-- <br>&nbsp;&nbsp;Edson Tirelli<br>&nbsp;&nbsp;Software Engineer - JBoss Rules Core Developer<br>&nbsp;&nbsp;Office: +55 11 3529-6000<br>&nbsp;&nbsp;Mobile: +55 11 9287-5646<br>&nbsp;&nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com">
www.jboss.com</a>