How to define dynamic CONDITION in guided decision tables using drools workbench

887 views
Skip to first unread message

hareesh kumar

unread,
Jul 18, 2016, 7:53:05 AM7/18/16
to Drools Usage
Hi all,

I am using drools work bench 6.4.0 Final.
is it possible to create rules with extended decision tables like below:

CONDITION        ACTION
age                    type
--------------------------------------
<18                    minor
>18                    major
>60                    senior


Cureently am doing like below:

CONDITION     CONDITION     ACTION
age >                   age<             type
-----------------------------------------------------------
18                                             major
60                                             senior
                            18                 minor


Can anyone please help me??

Michael Anstis

unread,
Jul 19, 2016, 6:35:40 AM7/19/16
to Drools Usage
If you define a column and pick "(no operator)" in the drop-down you can specify the operator in the cell.

You however loose any data-type validation (the cell effectively becomes a Textbox) so you can enter, for example, "> banana" for a numerical field.

--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@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-usage/ab4f6543-95b8-4ed0-86a3-34d1315c9928%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

hareesh kumar

unread,
Jul 19, 2016, 8:41:00 AM7/19/16
to Drools Usage
@Michael i already tried that..

am able to define in Guided decision table "editor" but not reflecting in source

it is displaying empty like below:

when
tt : Test( )

Michael Anstis

unread,
Jul 19, 2016, 9:19:42 AM7/19/16
to Drools Usage
I tried it too.. that's how I could reply to your email!

Can you give the complete example you are trying (data model, column definition etc)?

hareesh kumar

unread,
Jul 19, 2016, 9:56:42 AM7/19/16
to Drools Usage
Here is my Data Object:

package test.testing;

/**
 * This class was automatically generated by the data modeler tool.
 */

public class PersonDetails implements java.io.Serializable
{

   static final long serialVersionUID = 1L;

   @org.kie.api.definition.type.Label(value = "Age")
   private java.lang.Integer age;
   @org.kie.api.definition.type.Label(value = "Name")
   private java.lang.String name;

   public PersonDetails()
   {
   }

   public java.lang.Integer getAge()
   {
      return this.age;
   }

   public void setAge(java.lang.Integer age)
   {
      this.age = age;
   }

   public java.lang.String getName()
   {
      return this.name;
   }

   public void setName(java.lang.String name)
   {
      this.name = name;
   }

   public PersonDetails(java.lang.Integer age, java.lang.String name)
   {
      this.age = age;
      this.name = name;
   }

}

Attached column definition, action definition and decision table.

Here is Rule source:

package test.testing;

//from row number: 1
rule "Row 1 testGuidedTable"
dialect "mvel"
when
ageValidation : PersonDetails( )
then
modify( ageValidation ) {
setName( " Minor" )
}
end
Action definition.png
ColumnDefinition.png
decsiontable.png

Michael Anstis

unread,
Jul 19, 2016, 10:05:18 AM7/19/16
to Drools Usage
You need to click on the "operator drop-down" and select "(no operator)".

hareesh kumar

unread,
Jul 19, 2016, 10:43:56 AM7/19/16
to Drools Usage
Yes @Michael.. i have selected that only :)

It is showing as "please select an operator" even after selecting (no operator) option for me.

Note: 1.  If i do not select anything from dropdown, it is asking me to select operator
2. If i select (no operator) then it is accepting but showing as "please select an operator"

Do i need to do any settings??

Michael Anstis

unread,
Jul 19, 2016, 6:37:20 PM7/19/16
to Drools Usage

Hmm. Ok to be honest I tried 7.0.0-SNAPSHOT... can you try the same? If I get a chance I'll try 6.4 (but if it's a bug it won't be fixed until 7.x)

Daniel Alvarez

unread,
Jan 24, 2017, 12:56:24 PM1/24/17
to Drools Usage
Hi Hareesh, did you find any solution for this? I have the same problem with object Map, only can select "equal to", "null" ...etc., but I want select minor or major... 
Reply all
Reply to author
Forward
0 new messages