Select Your Language

Infrastructure and Management

Cloud Computing

Storage

Runtimes

Integration and Automation

  • Comments
  • Missing varibale binding in Drools

    Posted on

    I am using kie workbench's 6.2 guided decision table and I am stuck with the following scenario

    I want to set the promocode in promotion only if the PromoCode from EligibilityCriteria is checked against the some values in the rule. like shown below in code generated by workbench from the decision table

    //from row number: 1
    rule "Row 1 test"
    dialect "mvel"
    when
    $e : EligibilityCriteria( $code : PromoCode in ( "code1", "code2" ) , $make : vehMake == "BMW" )
    then
    Promotion p = new Promotion();
    p.setPromoId("123");
    p.setPromoCode($code);
    insertLogical( p );
    end

    If no value is specified for the promocode on the text box on guided decision table the generated does not creates the variable $code and the code fails since $code is not created

    //from row number: 1
    rule "Row 1 test"
    dialect "mvel"
    when
    $e : EligibilityCriteria($make : vehMake == "BMW" )
    then
    Promotion p = new Promotion();
    p.setPromoId("123");
    p.setPromoCode($code);
    insertLogical( p );
    end

    I just want to somehow indicate whether the rule field for promocode is empty or it has some value.

    by

    points

    Responses

    Red Hat LinkedIn YouTube Facebook X, formerly Twitter

    Quick Links

    Help

    Site Info

    Related Sites

    © 2026 Red Hat