[rules-users] Can we use 'from' CE in Decision Tables ?

groovenarula gnarula1 at la-z-boy.com
Thu Dec 3 01:51:18 EST 2009


Hello all,
Is it possible to define the follow rule in a decision table :

rule "Activate Promotion"
	when
		l : Line( )
		not ( Promotion ( code == "HOTBUY" ) from l.promos )
	then
	       #do some action
end

The rule above works perfectly for what I need when defined in a rule file.
However, when I try to define it in a decision table so that the 'code' can
be feed from a spreadsheet, I use the following values in the rules cells :
  
   RuleTable 	                                                               
HOTBUYS
   CONDITION	                                                               
ACTION
    l : Line	
    not ( Promotion ( code == "$param" ) from l.promos ) 
System.out.println("$param added");
    PROMOTION                                                              
PROMOTION
    HOTBUY                                                                     
BESTBUY

I'm getting the following parser errors 

[10,17]: [ERR 101] Line 10:17 no viable alternative at input 'Promotion' in
rule "_11" in pattern Line
[10,29]: [ERR 101] Line 10:29 no viable alternative at input 'code' in rule
"_11"
[10,63]: [ERR 102] Line 10:63 mismatched input ')' expecting 'then' in rule
"_11"
java.lang.IllegalArgumentException: Could not parse knowledge.
	at
com.sample.DecisionTableTest.readKnowledgeBase(DecisionTableTest.java:85)
	at com.sample.DecisionTableTest.main(DecisionTableTest.java:28)

Also in  Eclipse IDE, I get the following error :
"Unknown error while parsing. This is a bug. Please contact the Development
team." 	NewPromotions.xls

Is it possible to use 'from' conditional element in decision tables ? If so,
what am I doing wrong. If not, then what's the best approach to implement
the rule above in a decision table.

I'm running Drools 5.1.0M1 in Eclipse.

Help truly appreciated.
Gurvinder



-- 
View this message in context: http://n3.nabble.com/Can-we-use-from-CE-in-Decision-Tables-tp67005p67005.html
Sent from the Drools - User mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20091202/fc175ca3/attachment.html 


More information about the rules-users mailing list