[rules-users] RE: Rules with Lookup Tables...

Edson Tirelli tirelli at post.com
Wed Mar 7 18:11:59 EST 2007


  I'm not sure I understood what you are trying to do, but syntax is 
more like:

rule ...
when
    // getting the codes from the table
    Code( $shCode : sh_code ) from lookupDAO.getLookupValues( 
"MILT.CUSTNO" )

    // matching the objects if the code
    $gateIN : RKEM_Move( CUSTOMER_REFERENCE_NUMBER matches "^HX.*",
                                           ACTIVITY_LOCATION matches 
"^US.*",
                                           list contains $shCode )
then
   // do something
end

   There are other ways of writing this, but I would like to have your 
rule written down in english before suggesting something else... :)

   []s
   Edson

jdepaul wrote:

>I have configured 3.1.0M1 on my local machine with the corresponding IDE... 
>now I need help with the rule syntax.  I have configured a DAO which will
>return an ArrayList of values representing a list of values from the lookup
>table - I tried this, but I'm having problems...:
>
>
>rule "GATE-IN Match"
>	
>// This rule should match IF:
>//  CUSTOMER_REFERENCE_NUMBER starts with 'HX', and 
>//  ACTIVITY_LOCATION starts with "US" 
>//  SH_CODE exists in lookup table idenfied by key "MILT.CUSTNO"	
>	
>	when
>		$GateIN : RKEM_Move (CUSTOMER_REFERENCE_NUMBER matches "^HX.*", 
>                                                 ACTIVITY_LOCATION matches
>"^US.*",
>		                    $list : (from
>lookupDAO.getLookupValues("MILT.CUSTNO")) contains $GateIN.getSH_CODE()  )
>		                      
>	then 
>	   System.out.println("Matched 001695568GP GATE-IN Match Rule - about to
>inovke Service...");
>		
>end
>
>
>
>
>
>Anstis, Michael (M.) wrote:
>  
>
>>I don't have the syntax at hand but Edson has previously posted about
>>using "from" in similar circumstances.
>>    
>>
>
>  
>


-- 
 Edson Tirelli
 Software Engineer - JBoss Rules Core Developer
 Office: +55 11 3124-6000
 Mobile: +55 11 9218-4151
 JBoss, a division of Red Hat @ www.jboss.com





More information about the rules-users mailing list