<br><font size=2 face="sans-serif">Hello there,</font>
<br>
<br><font size=2 face="sans-serif">I wanted to refer to a variable in a
split constraint in a ForEach node. What is the correct way to nest a split
node in a ForEach node and refer to the variable of the collection?</font>
<br>
<br><font size=2 face="sans-serif">I have tried the following:</font>
<br>
<br><font size=2 face="sans-serif">a) &nbsp;Start process and insert process
into session, providing the map containing the collectionExpression. Using:</font>
<br>
<br><font size=2 face="sans-serif">&lt;import name=&quot;org.drools.runtime.process.WorkflowProcessInstance&quot;/&gt;
</font>
<br>
<br><font size=2 face="sans-serif">processIntance: WorkflowProcessInstance()</font>
<br><font size=2 face="sans-serif">$item: MyObject: (this == (processInstance.getVariable(&quot;item&quot;)))</font>
<br>
<br><font size=2 face="sans-serif">this doesn't seem to grab the variable
like I expected it to.</font>
<br>
<br><font size=2 face="sans-serif">How can I assign processInstance.getVariable(&quot;item&quot;)
itself to a variable? (I imagine this would work if this did)</font>
<br>
<br>
<br><font size=2 face="sans-serif">b) Set the variable on the global process
from the current context</font>
<br>
<br><font size=2 face="sans-serif">kcontext.getProcessInstance().setVariable(&quot;item&quot;,
kcontext.getVariable(&quot;item&quot;)</font>
<br>
<br>
<br><font size=2 face="sans-serif">I know this is not the right answer.</font>
<br>
<br><font size=2 face="sans-serif">c) Insert the item in an action at the
beginning of the loop. Retract it at the end. I then match against the
item of type MyObject at the beginning.</font>
<br>
<br><font size=2 face="sans-serif">// in action:</font>
<br><font size=2 face="sans-serif">insert(item)</font>
<br><font size=2 face="sans-serif">// in constraint</font>
<br><font size=2 face="sans-serif">$item: MyObject()</font>
<br><font size=2 face="sans-serif">// after action</font>
<br><font size=2 face="sans-serif">retract(item)</font>
<br>
<br><font size=2 face="sans-serif">This requires looping in Java to start
the processes individually and setting the variable explicitly each time.</font>
<br>
<br><font size=2 face="sans-serif">This seems a bit of a roundabout way
of doing it, what is *the* correct method?</font>
<br>
<br><font size=2 face="sans-serif">Thanks,</font>
<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>