[rules-users] Can we set a default value for emlpty cells in Drools templates

Michael Anstis michael.anstis at gmail.com
Fri Jan 20 05:56:30 EST 2012


We have also added the ability to use BRL Fragments as columns in the
guided Decision tables (for 5.4.0.beta2).

http://blog.athico.com/2012/01/guided-decision-table-supports-brl.html

You could then define a column as:-

$c : Company()
Company (this == $c, something = {templateKey} )

In rows where you don't specify a value for "templateKey" remaining
patterns (i.e. "$c : Company()") are still appended to the resulting DRL.

Furthermore the bound Company, $c, can be referenced either in other BRL
fragments or regular decision table columns.

On 20 January 2012 09:25, Swindells, Thomas <TSwindells at nds.com> wrote:

> There isn't a nice way to do this unfortunately.
> One hack around it is to have two columns with the object merged across
> them
> The first column would have the condition $a : Company(this != $param),
> every cell in the column is then given the value 'null'.
> This would then always ensure that $a will always exist. The second column
> can then be written as normal with your optional condition.
>
> Thomas
>
> > -----Original Message-----
> > From: rules-users-bounces at lists.jboss.org [mailto:rules-users-
> > bounces at lists.jboss.org] On Behalf Of swaroop
> > Sent: 20 January 2012 08:34
> > To: rules-users at lists.jboss.org
> > Subject: [rules-users] Can we set a default value for emlpty cells in
> Drools
> > templates
> >
> > Hi,
> >
> > I am trying to write a template and came across a scenario where one of
> the
> > condition cell                         $a : Company(condition), When
> > condition is left blank then entire predicate is missed and iam using
> the ref of
> > the company obj $a to set some values which is failing as the
> declaration part
> > is missing, So i was thinking, if we can have a default value to the
> cell as $a :
> > Company(), then the scenario will be handled.Kindly let me know how to
> > implement the default value for a cell in template to overcome the above
> > mentioned scenario
> >
> >
> > Thanks
> > Swaroop
> >
> > --
> > View this message in context: http://drools.46999.n3.nabble.com/Can-we-
> > set-a-default-value-for-emlpty-cells-in-Drools-templates-
> > tp3674849p3674849.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
>
>
>
> **************************************************************************************
> This message is confidential and intended only for the addressee. If you
> have received this message in error, please immediately notify the
> postmaster at nds.com and delete it from your system as well as any copies.
> The content of e-mails as well as traffic data may be monitored by NDS for
> employment and security purposes. To protect the environment please do not
> print this e-mail unless necessary.
>
> NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18
> 4EX, United Kingdom. A company registered in England and Wales. Registered
> no. 3080780. VAT no. GB 603 8808 40-00
>
> **************************************************************************************
>
> _______________________________________________
> rules-users mailing list
> 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/20120120/dbfed81e/attachment.html 


More information about the rules-users mailing list