[rules-users] Rule template shortcut needed

Wolfgang Laun wolfgang.laun at gmail.com
Wed Aug 18 08:39:16 EDT 2010


On 18 August 2010 13:31, djb <dbrownell83 at hotmail.com> wrote:
>
> Hi there,
>
> My question is related to the ability to remove criterion in a rule template
> by a cunning commenting trick so that if the variable @{VAR} is blank, the
> line will be blank.  Wolfgang wrote the code, I believe.

Not true, if you mean the template-+spreadsheet rule expansion code.

But I did write the classes for the instantiation of templates where
parameters come from Beans or Maps.

>
> I've got a situation where I've got DB rows where i've got:
> TYPE  |  CODE  |  TYPE2  |  CODE2_FROM  |  CODE2_TO
>
> there are 17 types.  So it lets us have rules like
> Type U code 123 cannot be charged with Type V codes 234 to 236.
>
> I need the rules to compare the correct property, but I don't want to lose
> the advantage of the RETE algorithm by using a getValue("type1") function.
>
> I see one solution:
> 2.  Make a template with 17 + 17 + 17 = 51 columns, where each one uses the
> // @{VAR} trick.

Notice that *any* part of a template can be a formal parameter. So a line could
also be s.th. like
   @{CLASS} ( @{FIELD} == @{VALUE} )

-W


>
> Is there a better way?  Or, should I just do getValue("type")?
>
> Thanks
> Daniel
>
>
> --
> View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Rule-template-shortcut-needed-tp1203969p1203969.html
> Sent from the Drools - User 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