0

I want to convert the below rule to decision table,

when
  customer:Customer(purchase > 1000)
  person:Person()
then
  person.markValuableCustomer(customer.id); 
end

I tried to convert this to decision table but I am not sure how to declare the person object. As you can see in the excel I created a new Condition for it.

I tried in a CONDITION column as person:Person but I get some error saying condition has to be entered.

So how to create a object in decision table which has to be used in Action column ?

Please find the excel data just in case if image uploaded is not opening.

    RuleTable HelloWorld1   
    CONDITION                                            CONDITION             ACTION

    customer:CustomerInfo   
    customer.purchase > "$param" && customer.valid        person:Person();  person.markValuableCustomer(customer.id)

    Purchase    
    1000    

enter image description here

Lolly
  • 34,250
  • 42
  • 115
  • 150

1 Answers1

1

You can use this trick:

    RuleTable HelloWorld1   
    CONDITION                      CONDITION        ACTION

    customer:CustomerInfo          person:Person()
    customer.purchase > "$param"   /*$param*/       person.mark(customer.id)
    Purchase    
    1000                              x

You can join the cells of the condition column so that a single 'x' is sufficient.

laune
  • 31,114
  • 3
  • 29
  • 42
  • @luane : Thanks for your reply. I tried your solution but I am getting the same error. Assuming there are 3 columns and 6 rows, what are cells you want to join ? 5:2 and 6:2 ? – Lolly Jun 17 '17 at 08:38
  • Join those in the condition column for `Person` where the row for CustomerInfo has values 1000 and below. But htis is optional - you can put an 'x' in each row where you want to have `Person` in the rule. – laune Jun 17 '17 at 13:41