Hello,
I have a fact called 'Option' :
public class Option {
private String code;
private Item item;
public String getCode() {
return code;
}
public void setCode(String optionCode) {
this.code = optionCode;
}
At any point in time, the working memory can have several Option instances
with different code values. My rules need to fire specifically when the
working memory contains a specific set of options. e.g. Rule 1 should fire
if and only if the working memory contains 2 option instances one with code
"P1" and the other with "P2" (order should not matter).
I tried to use 'forall' as follows :
rule "Matched Options"
when
forall (
Option ( code == "P1" || code == "P2" )
)
then
//insert( new IsPriced( i ) );
System.out.println ( "Priced using G/S ");
end
However, the rule above never fires. Maybe I should be taking a different
approach. I'm still learning through how to create rules. So any
help/suggestions on how to tackle the above will be appreciated.
Thanks
Gurvinder
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/How-to-write-a-rule-t...
Sent from the Drools - User mailing list archive at
Nabble.com.