[rules-users] How to Access Rule RHS (THEN Part) from JAVA?

Wolfgang Laun wolfgang.laun at gmail.com
Fri Jul 13 06:27:49 EDT 2012


If you change a fact and want to inspect it after firing all rules, use a query.

There is an example in the Drools Expert manual.

-W


On 13/07/2012, Ravikiran <ravikiran.kakarla at gmail.com> wrote:
> Hi Laune,
>
> As i mentioned before, I have given some sample code only before. But i
> actually meant that "percent" is an instance variable of type double from
> class "LoanFormula", sorry for creating the confusion. Both Person & Loan
> formula classes are like this,
> declare Person
>   age: Integer
>   -------
> end
> declare LoanFormula
>   percent: Double
> end
> If the above two classes are part of my Model and if my Rule 1 like below
>
> rule "Rule 1"
>     salience 10
>     dialect "mvel"
>     when
> 	a : LoanFormula( )
> 	exists (Person( age > "25" ))
>     then
> 	a.setPercent(2.5 );
> end
>
> >From the above Rule, When i fire "Rule 1" from my Java client and i pass
> age
> of a Person greater than 25, then i should be able to retrieve the percent
> value as 2.5. I hope this would have been much clearer for you now.
> Thanks in advance...
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/How-to-Access-Rule-RHS-THEN-Part-from-JAVA-tp4018651p4018657.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


More information about the rules-users mailing list