It isn't reasonable to expect readers to understand
incomplete code. There is no way we can know where
the list comes from, where and how it is stored and
passed to the function.
But one thing is sure: There is no way you can interleave
the execution of right hand sides the way you expect it.
Once a RHS executes, it is a "run to completion", (except
when an exception is thrown.)
Rather than posting incomprehensible pseudo-codes,
state *what* you need to do, not some way how (not)
to do it.
-W
On 03/08/2012, RulesUsers <agrawalmanisha26(a)gmail.com> wrote:
Hi Davide,
Thanks for the prompt reply,
Now i have changed my requirement a bit, to make it much simpler
function boolean foo(List list){
//do some action on the list & set true false accordingly.
system.out.println("foo ");
return true/false;
}
rule "one"
no-loop
salience -1
when
//condition 1
then
system.out.println("one in");
//populate a list
system.out.println("one out");
end
rule "two"
salience -2
when
eval(foo(pass the list that we populated in the above rule))
then
system.out.println("two in");
//do some action
system.out.println("two out");
end
O/P we are getting: -
foo
one in
foo
foo
one out
two in
two out
Expected O/P
one in
one out
foo
two in
two out
Please suggest a way to do the same.
Regards,
Sam
--
View this message in context:
http://drools.46999.n3.nabble.com/Calling-a-function-from-When-part-tp401...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users