<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>Hi, All,<br>&nbsp;&nbsp;&nbsp;&nbsp; I have a similar questions to Jame's question. <br>&nbsp;&nbsp;&nbsp;&nbsp; I have a list of Strings which is wrapped in a class called Names, and what I want to get is to find all the elements that's equal to "targetStringname". <br>&nbsp;&nbsp;&nbsp;&nbsp; How do I create a rule using guided rule editor in Guvnor to create a rule which looks like the following? (Our system requires&nbsp; users to be able to create their own rules and I doubt that the users will know how to write rules like the following).<br><br>when<br>&nbsp;&nbsp; $name: Names( )<br>&nbsp;&nbsp; $foundThese: ArrayList (size &gt;0) from collect (String (this matches "targetname" ) from $name.names)<br></div><div style="font-family: times new roman,new york,times,serif; font-size:
 12pt;">then<br>&nbsp;&nbsp; System.out.println("something happened here");<br><br>public class Names {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private List &lt;String&gt; name = new ArrayList&lt;String&gt;();<br>}<br><br>Thanks a bunch!<br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> "Nord, James" &lt;JNord@nds.com&gt;<br><b><span style="font-weight: bold;">To:</span></b> rules-users@lists.jboss.org<br><b><span style="font-weight: bold;">Sent:</span></b> Tue, October 6, 2009 8:48:46 AM<br><b><span style="font-weight: bold;">Subject:</span></b> [rules-users] Guvnor test scenarios and collections.<br></font><br>


 

<div><span class="411514215-06102009"><font size="2" face="Arial">Hi 
all,</font></span></div>
<div><span class="411514215-06102009"><font size="2" face="Arial"></font></span>&nbsp;</div>
<div><span class="411514215-06102009"><font size="2" face="Arial">One of our facts has 
a collection which the rules add to.</font></span></div>
<div><span class="411514215-06102009"><font size="2" face="Arial"></font></span>&nbsp;</div>
<div><span class="411514215-06102009"><font size="2" face="Arial">I'm trying to write 
a test scenrio to cover the simple case where the fact with an empty collection 
runs through and ends up containing a value "default".</font></span></div>
<div><span class="411514215-06102009"><font size="2" face="Arial"></font></span>&nbsp;</div>
<div><span class="411514215-06102009"><font size="2" face="Arial">However I can't work 
out how to get Guvnor to do this.&nbsp; I am presented with fact.blah and then 
"equals" or "does not equal" but no contains or does not 
contain.</font></span></div>
<div><span class="411514215-06102009"><font size="2" face="Arial">I have tried the 
MVEL syntax of [default] but this complains that the expectation fails as: 
"</font><font face="Arial"><font size="2">[myFact] field [myCollection] was 
[[DEFAULT]] expected [[DEFAULT]].<span class="411514215-06102009">"</span></font></font></span></div>
<div><span class="411514215-06102009"><font face="Arial"><font size="2"><span class="411514215-06102009"></span></font></font></span>&nbsp;</div>
<div><span class="411514215-06102009"><font face="Arial"><font size="2"><span class="411514215-06102009">Is there any any way to do 
this?</span></font></font></span></div>
<div><span class="411514215-06102009"><font face="Arial"><font size="2"><span class="411514215-06102009"></span></font></font></span>&nbsp;</div>
<div><span class="411514215-06102009"><font face="Arial"><font size="2"><span class="411514215-06102009">Regards,</span></font></font></span></div>
<div><span class="411514215-06102009"><font face="Arial"><font size="2"><span class="411514215-06102009"></span></font></font></span>&nbsp;</div>
<div><span class="411514215-06102009"><font face="Arial"><font size="2"><span class="411514215-06102009">&nbsp;&nbsp;&nbsp; 
/James</span></font></font></span></div><br>**************************************************************************************<br>This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.<br><br>NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00<br>**************************************************************************************</div></div></div><br>



      </body></html>