On 16/08/2012, Rana <ven12...@yahoo.com> wrote:
> How can I fire one rule file if I have lot of rule files defined in my
> change
> set. Right now I have written an if-else condition and checking if the
> input
> is Androgel then fire Angrogel rule fire.

But a rule (as you have it) with
   Drug( brandName == "AndroGel" )
will take care of that automaticaliy. This can co-exist with lots of
similar rules for anything between "Aspic" to "Zodiac".

>
> But how can I do that in real time.
>
> Also I have a requirement which says it needs the reason why the rule
> failed.

This is quite difficult if your rules are non-trivial except when there is a
restricted way facts are inserted and rules are fired. And even then it
requires a circumspect approach.

> So I have done this, I am setting all the actual and real values
> and
> saving the data to database in my event listeners.

Not clear what you gain by this.

>
> But I get this "Cannot return a void result" at line 6.

A method called in an eval must return a boolean, or has to be called
in a context that compares the result so that the comparison returns a
boolean. A "void" method can't be called at all.

-W

>
> rule "Brand Name"
>       no-loop true
>       agenda-group "AndroGel"
>     when
>       $drug : Drug()
>         eval( progRuleValidationLog.setActualValue($drug.getBrandName()) )
>
> //line 6
>         eval( progRuleValidationLog.setRuleValue("AndroGel") )
>         Drug( brandName == "AndroGel" )
>     then
>               #drools.getWorkingMemory().setGlobal("boolBrandName", true);
>               log.info("Brand Name is AndroGel");
> end
>
>
> Thanks.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to