object cannot be resolved in decision table

794 views
Skip to first unread message

code...@gmail.com

unread,
Jun 5, 2015, 7:42:04 PM6/5/15
to drools...@googlegroups.com
I have been trying to use Drools 6.0.1 with Spring and am getting an error on the decision table used. I am trying to have 2 objects - one as a Fact and the other as the Result. I can use the "result" in the CONDITION column but am not able to use the same object in the ACTION block. 

CONDITION CONDITION CONDITION CONDITION ACTION   ACTION
rule:Rule result:Result    
rule.country rule.state rule.isNew result.ans result.setAns("$param");  rule.setAnsOnRule("$param");

The above is the section from the decision table. In my code, the rules under the 4th column work fine(the result object is present). Also, the last column (second Action above) - is fine too - the Ans on the Rule object is set properly. But the first Action above gives me the error: "Rule Compilation Error" .... "result cannot be resolved."

I don't understand why "result" is resolved in the "condition" but not in the "action". If I remove the first Action column from the decision table, everything works fine.

Mark Proctor

unread,
Jun 6, 2015, 3:32:39 AM6/6/15
to drools...@googlegroups.com
I don't think you can use 'rule' as a keyword. Change that and see if thing improve.
--
You received this message because you are subscribed to the Google Groups "Drools Setup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-setup...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-setup/404454c5-32cc-44d9-a7a9-1a4d0c81c7a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

code...@gmail.com

unread,
Jun 7, 2015, 1:05:37 PM6/7/15
to drools...@googlegroups.com
Thanks for the reply Mark.
I tried using a different class and object names. Didn't change the result. Here is what I used...

CONDITIONCONDITIONCONDITIONCONDITIONACTION  ACTION
route:RouteAttributeresultOfInput:Result  
route.countryroute.stateroute.isNewresultOfInput.ansresultOfInput.setAns("$param"); route.setAnsOnRule("$param");

Getting a similar error..  "resultOfInput cannot be resolved"

On Saturday, June 6, 2015 at 12:32:39 AM UTC-7, Mark Proctor wrote:
I don't think you can use 'rule' as a keyword. Change that and see if thing improve.

On Saturday, 6 June 2015, <code...@gmail.com> wrote:
I have been trying to use Drools 6.0.1 with Spring and am getting an error on the decision table used. I am trying to have 2 objects - one as a Fact and the other as the Result. I can use the "result" in the CONDITION column but am not able to use the same object in the ACTION block. 

CONDITION CONDITION CONDITION CONDITION ACTION   ACTION
rule:Rule result:Result    
rule.country rule.state rule.isNew result.ans result.setAns("$param");  rule.setAnsOnRule("$param");

The above is the section from the decision table. In my code, the rules under the 4th column work fine(the result object is present). Also, the last column (second Action above) - is fine too - the Ans on the Rule object is set properly. But the first Action above gives me the error: "Rule Compilation Error" .... "result cannot be resolved."

I don't understand why "result" is resolved in the "condition" but not in the "action". If I remove the first Action column from the decision table, everything works fine.

--
You received this message because you are subscribed to the Google Groups "Drools Setup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-setup+unsubscribe@googlegroups.com.

Michael Anstis

unread,
Jun 7, 2015, 1:21:58 PM6/7/15
to drools...@googlegroups.com

Can you include the data rows you have for the headers you show? It could well be a cell has no value for the column binding "resultOfInput" and hence, for that row, it is not available in the RHS.

> Sent when I shouldn't really be working.

To unsubscribe from this group and stop receiving emails from it, send an email to drools-setup...@googlegroups.com.

To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-setup/404454c5-32cc-44d9-a7a9-1a4d0c81c7a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Drools Setup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-setup...@googlegroups.com.

To post to this group, send email to drools...@googlegroups.com.

code...@gmail.com

unread,
Jun 7, 2015, 6:45:58 PM6/7/15
to drools...@googlegroups.com
Hi Michael, 
I can understand what you mentioned in your post. In my last condition column (second rule/row), I don't have the "ans" populated. I am expecting that value to not be present. In fact, in my actual implementation, I am just expecting the "resultOfInput" to be used in the "Action" and not used on the "condition". Based on your last input, I tried to put a value in the last Action of the second rule below - that made the code run without errors. But, I am not sure why that is mandatory. 

CONDITION CONDITION CONDITION CONDITION ACTION ACTION
route:RouteAttribute resultOfInput:ResultOfInput    
route.country route.state route.isNewEntry
resultOfInput.ans resultOfInput.setAns("$param"); route.setAnsOnRule("$param");
country state is this new information answer answer answer
US   FALSE Ans Ans2 Ans2
US   TRUE   Ans3 Ans3
Thanks for your help.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-setup+unsubscribe@googlegroups.com.

To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-setup/404454c5-32cc-44d9-a7a9-1a4d0c81c7a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Anstis

unread,
Jun 8, 2015, 4:46:38 AM6/8/15
to drools...@googlegroups.com
The CONDITION columns do just that; define constraints: if you do not have a value for a row/column the constraint is omitted.

You can achieve a CONDITION column that generates DRL without a constraint e.g. $p:Person() as discussed here: http://drools-moved.46999.n3.nabble.com/Need-help-with-Decision-Table-Conditions-td2195003.html

(See the part talking about "$pgMeta: PageMeta()").

With kind regards,

Mike



To unsubscribe from this group and stop receiving emails from it, send an email to drools-setup...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-setup/404454c5-32cc-44d9-a7a9-1a4d0c81c7a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Drools Setup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-setup...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-setup/cb8112ac-54af-4d04-8c86-9f3b973bc574%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Drools Setup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-setup...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.

code...@gmail.com

unread,
Jun 15, 2015, 7:06:35 PM6/15/15
to drools...@googlegroups.com
Thanks Mike. That helps.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-setup+unsubscribe@googlegroups.com.

To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-setup/404454c5-32cc-44d9-a7a9-1a4d0c81c7a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Drools Setup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-setup...@googlegroups.com.
To post to this group, send email to drools...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-setup/cb8112ac-54af-4d04-8c86-9f3b973bc574%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

sanjay manna

unread,
Jun 22, 2018, 2:44:31 AM6/22/18
to Drools Setup
Thanks It relay help me.
Reply all
Reply to author
Forward
0 new messages