[rules-users] How do I reference newly asserted facts?

Darko IVANCAN ivancan at gmx.de
Mon Dec 10 12:31:41 EST 2007


Hi,

In the BRMS you can assign a variable to your fact in the LHS.
This would then result in:
when
    a : FNAC_CLIENT_CONTROL( FNAC_BIRTH_PLACE == "IL" )
then
   a.set....

good luck,
Darko Ivancan

On 10/12/2007 20:38, kissro at lidp.com wrote:
> Hello,
>
> I am creating all my rules using the BRMS guided rule editor gui.
> In the rule editor, I have a rule that looks like this:
>
> WHEN
>       FNAC_CLIENT_CONTROL
>   FNAC_BIRTH_PLACE is equal to "IL"
>
> THEN
>   Assert FNCM_COMMENT FNCM_VARIABLE_DATA "This client lives in Illinois"
>
> When I click the 'View Source' button I see this:
>
> rule "Rule500"
>    dialect "mvel"
>    when
>          FNAC_CLIENT_CONTROL( FNAC_BIRTH_PLACE == "IL" )
>    then
>          FNCM_COMMENT fact0 = new FNCM_COMMENT();
>          fact0.setFNCM_VARIABLE_DATA( "This client lives in Illinois");
>          insert( fact0 );
> end
>
> After I return from "fireAllRules", how do I reference the newly
> asserted fact in my Java code?  Do I reference "fact0" or can I use the
> object's "real" name - FNCM_COMMENT.FNCM_VARIABLE_DATA?
>
> "fact0" is just a generated name created by BRMS when it generates the
> rule based on what I type in the gui, right?  I'm assuming if I insert
> more facts, they would be called fact1, fact2, etc.  If I want to
> reference these facts, do I have to keep track of how many I've inserted
> then reference the appropriate fact number?  I'm not sure how to
> reference these generated fact names after returning from the rule
> engine.  Could someone help me?
>
> Thanks,
> Rod  
> _______________________________________________
> 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