[rules-users] [droolsflow] ForEach usage - Version 5.1.0

Anderson vasconcelos anderson.vass at gmail.com
Wed Oct 7 17:08:43 EDT 2009


Hi All
To use a ForEach element i need to access a collection inside my
FactObject.  (FactObject.list)
I tried to call FactObject.list inside a CollectionExpressions but this
fail. (Just ok with list defined as a process variable)
*So i do something thats a consider a workaround:*

1- I Create a '"Action Node" before a "ForEach Node"

2-In the "Action Node", i get the FactObject and populate the process
variable that represents FactObject.list :
*FactObject factObject =
(FactObject)drools.getKnowledgeRuntime().getObjects(new
ClassObjectFilter(FactObject.class)).iterator().next();
context.setVariable("list", factObject.getDefeitos());*

3- And on the "Foreach node" i just  passed the "list" in the
CollectionExpressions

This is the correct way to do this? Has a better way to get FactObject.list
to use on "For Each Node"?

On Eclipse, the CollectionExpression of forEach don't have a window (Like
Action Editor) to put a MVEL/Java expressions. I think this is a interesting
resource.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20091007/44668ece/attachment.html 


More information about the rules-users mailing list