[rules-users] [droolsflow] ForEach usage - Version 5.1.0
Kris Verlaenen
kris.verlaenen at cs.kuleuven.be
Thu Oct 8 06:40:19 EDT 2009
This is possible, if you only have one FactObject in the working memory.
In general, I think it is probably a better idea to either pass this
data in as a parameter when starting the process (so you can store it as
a variable then), or maybe use a global (if there only is one anyway).
Kris
Quoting Anderson vasconcelos <anderson.vass at gmail.com>:
> 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.
>
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
More information about the rules-users
mailing list