Drools compares two objects in a decision table

I have the following code in a DRL file

rule "MyExample"
when
    $eentity : ExampleEntity()
    $sentity : SecondEntity( secondField == $eentity.getMainField())
then
    System.out.println(true);

end

This works, but I need to convert it to a spreadsheet. I tried so many options, but no one works. How can I write this rule in the decision table?

0
source share
1 answer

Use one condition column:

CONDITION
ExampleEntity($mf: mainField) SecondEntity
secondField == $mf /*param*/
Combine Ex with Sec on equal field values
x

/*param*/and x- this is a hack to get the condition generated for the string.

+1
source

Source: https://habr.com/ru/post/1623485/


All Articles