<br><font size=2 face="sans-serif">Hello there,</font>
<br>
<br><font size=2 face="sans-serif">I am experimenting with Drools. I seem
to be having problems with making the ForEach element to work. It cannot
'see' the mappings created when I start the process. I am hand coding the
XML flow files and using the schema (and documentation) to help me.</font>
<br>
<br><font size=2 face="sans-serif">The problem seems to be in the flow
file before the rule file is even executed. Is this the correct way to
pass a collection to the process?</font>
<br>
<br><font size=2 face="sans-serif">// the collection to iterate over</font>
<br><font size=2 face="sans-serif">Collection&lt;BusinessObject&gt; pending
= new ArrayList&lt;BusinessObject&gt;();</font>
<br><font size=2 face="sans-serif">pending.add(new BusinessObject());</font>
<br><font size=2 face="sans-serif">pending.add(new BusinessObject());</font>
<br>
<br><font size=2 face="sans-serif">// the parameters for the process</font>
<br><font size=2 face="sans-serif">Map&lt;String, Object&gt; params = new
HashMap&lt;String, Object&gt;();</font>
<br><font size=2 face="sans-serif">params.put(&quot;pending&quot;, pending);</font>
<br>
<br><font size=2 face="sans-serif">ksession.startProcess(&quot;org.processor&quot;,
params);</font>
<br><font size=2 face="sans-serif">ksession.fireAllRules();</font>
<br>
<br><font size=2 face="sans-serif">In the rule file, I have:</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &lt;forEach
id=&quot;2&quot; name=&quot;processor&quot; variableName=&quot;current&quot;
collectionExpression=&quot;pending&quot; &gt; </font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &lt;in-ports&gt;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;in-port
type=&quot;DROOLS_DEFAULT&quot; nodeId=&quot;6&quot; nodeInType=&quot;DROOLS_DEFAULT&quot;
/&gt; </font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &lt;/in-ports&gt;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &lt;out-ports&gt;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;out-port
type=&quot;DROOLS_DEFAULT&quot; nodeId=&quot;8&quot; nodeOutType=&quot;DROOLS_DEFAULT&quot;
/&gt; </font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &lt;/out-ports&gt;</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &lt;nodes&gt;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &lt;start id=&quot;6&quot; name=&quot;test&quot;
/&gt;</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &lt;actionNode id=&quot;7&quot;&gt;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &lt;action type=&quot;expression&quot; dialect=&quot;mvel&quot;&gt;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; System.out.println(current);</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &lt;/action&gt;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &lt;/actionNode&gt;</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &lt;end id=&quot;8&quot; name=&quot;done&quot;/&gt;</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/nodes&gt;</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &lt;connections&gt;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;connection
from=&quot;6&quot; to=&quot;7&quot; /&gt;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;connection
from=&quot;7&quot; to=&quot;8&quot; /&gt;</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &lt;/connections&gt;</font>
<br>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/forEach&gt;</font>
<br>
<br>
<br><font size=2 face="sans-serif">I cannot tell if the scope inside the
ForEach &gt; nodes is separate from the outer-scope, can I use the same
IDs?</font>
<br>
<br><font size=2 face="sans-serif">The error I receive:</font>
<br><font size=2 face="sans-serif">Exception in thread &quot;main&quot;
java.lang.IllegalArgumentException: Could not find collection params</font>
<br>
<br>
<br>
<br><font size=2 face="sans-serif">What am I doing wrong?</font>
<br>
<br><font size=2 face="sans-serif">Regards,</font>
<br><font size=2 face="sans-serif">S. Squire</font>
<br>
<BR>
This message may contain confidential and privileged information and is intended solely for the use of the named addressee. Access, copying or re-use of the e-mail or any information contained therein by any other person is not authorised. If you are not the intended recipient please notify us immediately by returning the e-mail to the originator and then immediately delete this message. Although we attempt to sweep e-mail and attachments for viruses, we do not guarantee that either are virus-free and accept no liability for any damage sustained as a result of viruses.<BR>
<BR>
Please refer to http://www.bnymellon.com/disclaimer/piml.html for certain disclosures.<BR>