Thank you so much for the help.<br><br>I end up doing something similiar with what Shawn Garner suggested with the Scruber.<br><br>Thanks again.<br><br><br><div class="gmail_quote">2009/9/10 Wolfgang Laun <span dir="ltr">&lt;<a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">You cannot bind a variable to a function result, as in &quot;$word : hasForbiddenWordsSet( ... )&quot;.<br>
<br>I&#39;d use the original boolean function hasForbiddenWordsSet (which might even include the check against getTitle() returning null), and add another function, returning the string, to be called after &#39;then&#39;.<br>

<br>The first one could be implemented by calling the second one, and comparing the result to null. Since you probably expect that there aren&#39;t too many &quot;forbidden&quot; words in titles, the performance hit of calling the second one twice for each firing should be tolerable.<br>

<br>-W<br><br><br><div class="gmail_quote">2009/9/9 Leandro Carvalho <span dir="ltr">&lt;<a href="mailto:leandrodcarvalho@gmail.com" target="_blank">leandrodcarvalho@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5">
Hi! I&#39;m new here and a have a doubt about rules and functions in Drools.<br><br>I have this rule:<br><br>rule &quot;ProductDescription validation&quot;<br>    when<br>        $listing : Listing( $description:productDescription != null )<br>


        eval( $description.getTitle() != null )<br>        eval( hasForbiddenWordsSet( wordsSet, $description.getTitle() ) )<br>    then<br>        System.out.println(&quot;ERROR!&quot;);<br>end<br><br>And this function:<br>


<br>function boolean hasForbiddenWordsSet(Set wordsSet, String value) {<br>#do something useful here<br>}<br clear="all"><br><br>And everything works fine. But now I want that function &quot;hasForbiddenWordsSet&quot; return a String. For example to print at &quot;then&quot;.<br>


I tried something like this:<br><br>rule &quot;ProductDescription validation&quot;<br>
    when<br>
        $listing : Listing( $description:productDescription != null )<br>
        eval( $description.getTitle() != null )<br>
        $word : hasForbiddenWordsSet( wordsSet, $description.getTitle() )<br>
    then<br>
        System.out.println(&quot;ERROR: &quot; + word);<br>
end<br>
<br>function String hasForbiddenWordsSet(Set wordsSet, String value) {<br>
#do something useful here<br>
}<br><br>But it doesn&#39;t work, tried some other things and still no success.<br><br>Could someone help me?<br clear="all"><br>Thanks in advance.<br><br>-- <br><font color="#888888">Leandro Carvalho<br>
</font><br></div></div><div class="im">_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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>
<br></div></blockquote></div><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" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Leandro Carvalho<br>