Search code examples
drools

Drools multiple params in action sout


I have the following code (Here is the decision table) and I need to put multiple params to console output. How can I do it?


Solution

  • If both components change from row to row, it may be useful to have two action entries. If a constant should be appended, add it in the code snippet in line 3:

    ACTION             ACTION
    System.out         System.out
    print($param)      println($param + "!")
    part 1             part 2
    "The city is: "    $city.getName()
    "No such city"     ""
    

    As an alternative, use

    ACTION
    System.out
    println( $1 + ", " + $2 )
    both names
    $country.getName(),$city.getName()