[rules-users] How to call a method from a cell in Drools 5 decision table?

Tihomir Surdilovic tsurdilo at redhat.com
Tue Jan 19 09:59:27 EST 2010


Can't you as a workaround change your ACTION from

m.setMessage($param);update(m);
to
m.setMessage(m.getMessage("$param"));update(m);

and in your data column that gets interpolated replace
m.getMessage("msg")
with
msg

IMO this makes more sense where you have non-technical users modify the 
interpolated values of your DT.

jos at circuitdb.com wrote:
> I'm migrating an application from drools 4 to drools 5. I encountered some
> problems where our decision table uses calls to methods with String
> parameters in actions cells.
>
> I've reproduces the issue in the example decision table project generated
> by the eclipse plugin. After generating a new Drools project with decision
> table example I added the following to the Message class:
>
> public String getMessage(String dummy) {
>  return this.message;
> }
>
> In the decision table I change cell E9 from
> 'm.setMessage("$param");update(m);' to 'm.setMessage($param);update(m);'
> and cell E11 from 'Goodbye cruel world' to 'm.getMessage("msg")'.
>
> When I use this java and xls file with Drools 4 I get the folloowing at
> line 11 of the drl:
> m.setMessage(m.getMessage("msg"));update(m);
>
> But when I use Drools 5 I get escaped double-quotes which causes an error
> in com.sample.DecisionTableTest.readKnowledgeBase:
> m.setMessage(m.getMessage(\"msg\"));update(m);
>
> I have attached the java code, xls sheet and both generated drl files.
>
> Thanks in advance.
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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