[rules-users] Rule Templates - comma separated data

Witham, Darren darren.witham at citi.com
Wed Jun 22 04:17:18 EDT 2011


Thanks W - I can work with this

From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Wolfgang Laun
Sent: 21 June 2011 18:40
To: Rules Users List
Subject: Re: [rules-users] Rule Templates - comma separated data

The operators "in" and "not in" operate on parenthesized lists of operands. They can be used with a single template parameter expanding as a list.

   Person( likes in ( "apple", "banana", "chili" ) )

is the same as

  Person( likes == "apple" || == "banana" || == "chili" )

-W


On 21 June 2011 18:34, Witham, Darren <darren.witham at citi.com<mailto:darren.witham at citi.com>> wrote:
I have successfully generated a .drl file from a decision table. The column headers in this table made use of the forall(||) construct which happily parsed the corresponding comma separated data in the relevant spreadsheet cell to nice || separated conditions.

We have since decided to use the template approach so we can store rule data in a db. We ideally want to store this data as key/value pairs in a db table where the values may contain comma separated data. The intention being these values would be processed as per the decision table.

How is this achieved using a template ? I note that a column can be denoted as an array column by adding [] i.e.

template header
column[]


However, although this appears create an ArrayColumn parser, and splits the comma separated data when running through a debugger, any attempt to access it in the template falls over in mvel code trying to call HashMap.column


Any examples on how to set this up ?

Thx


_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org<mailto:rules-users at lists.jboss.org>
https://lists.jboss.org/mailman/listinfo/rules-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110622/0638d428/attachment.html 


More information about the rules-users mailing list