[rules-users] Using object.getter in Decision table

Swindells, Thomas TSwindells at nds.com
Tue Oct 4 04:59:26 EDT 2011


The best place to start is the drools documentation http://www.jboss.org/drools/documentation particularly the expert guide.
This shows both drl and spreadsheet syntax and examples.
You are getting the exception because the first line of the condition should just be an object restriction eg fact1 : DataObject()
Your second line is then a restriction on that data object.

What you send from your screen and what you insert into the working memory doesn't have to be identical.
Your screen may use a single object to relay the object but that doesn't mean you can't explode it into separate facts as you insert it into your working memory, but it depends on what you are trying to achieve - are these just validation rules or are you going to be modifying the objects?

Thomas

> -----Original Message-----
> From: rules-users-bounces at lists.jboss.org [mailto:rules-users-
> bounces at lists.jboss.org] On Behalf Of jilani
> Sent: 04 October 2011 09:43
> To: rules-users at lists.jboss.org
> Subject: Re: [rules-users] Using object.getter in Decision table
>
> Thank You for your reply.
>
> I am trying to access all the facts through one fact, actually the scenario is we
> have multiple screens in our application and each screen will have multiple
> fields where we want to show/hide the screen/field based on data provided
> in screens.
>
> So Instead of sending each screen data separate, We thought of sending the
> parent object and inside the rules(i.e decision table) we want to access the
> data of specific screen.
>
> As mentioned by you, I am using the intermediate DRL output using below
> code SpreadsheetCompiler sc = new SpreadsheetCompiler();
>         String drlstr = null;
>         try
>         {
>             drlstr =
> sc.compile(ResourceFactory.newClassPathResource(decisionTableSheet,
> this.getClass()).getInputStream(), InputType.XLS);
>         }
>
> Here it is giving the rule parse exception and returning the package as null.
>
> Coming to DRL, I am facing difficulty in defining rules like scenarios as below
>
> - null check
> - need to use java String methods like equals() and length()
> - setting data in HashMap, ArrayList
>
> Actually I tried the above using a rule definition in Guvnor.
>
> It would be helpful If you can provide me the URL or some information to
> write rules using DRL.
>
> My Development environment:
> Drools 5.2
> Eclipse with JBoss tools


**************************************************************************************
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
**************************************************************************************




More information about the rules-users mailing list