Drools - use of from in decision table

I am having trouble getting a rule that I know works in the form of .drl to work in a decision table.

Here is my drl rule:

rule = "slider1"
    dialect "mvel"
    when
        $person: Person()
        ArrayList( size >= 2 )
            from collect( TestResult( name in ("TestA","TestB"), result == "high" )
                           from $person.getLabResults()
                        )
    then
        $person.setString("It worked");
end

Here is what I am trying in a spreadsheet:

CONDITION
-------------------
$person:Person()
-------------------
ArrayList( size >= 1 ) 
    from collect( TestResult( name in $param, result == 'high' ) 
       from $person.getLabResults() ) 
-------------------
Lab Names
-------------------
"TestA","TestB"

When I try to run a rule from a distribution sheet, I get this error:

Error while creating KieBase[Message [id=1, level=ERROR, path=com/creo/drools/decisiontables/sample-decision-table.xls, line=11, column=0
text=[ERR 102] Line 11:53 mismatched input 'from' in rule "Young safe package 1"], Message [id=2, level=ERROR, path=com/creo/drools/decisiontables/sample-decision-table.xls, line=0, column=0
text=Parser returned a null Package]]

Something seems to not work correctly with the from clause, but I have no idea why. I have tried numerous google searches and this is the only thing I could find: http://drools-moved.46999.n3.nabble.com/Question-on-excel-decision-table-with-quot-variable-Type- from-collection-quot-td1186138.html

Any ideas? It drives me crazy why this will not work in the spread sheet.

+1
1

, , Drools. , , CONDITION CE, , , , , , , $param .

, () DRL:

$person:Person( ArrayList( size >= 1 ) 
from collect( TestResult( name in ("TestA","TestB"), result == 'high' ) 
   from $person.getLabResults() ) )

, , - from.

, , SpreadsheetCompiler , DRL, .

private void testSpreadsheet(String dtPath){
  File dtf = new File( dtPath );
  InputStream is;
  try {
    is = new FileInputStream( dtf );
    SpreadsheetCompiler ssComp = new SpreadsheetCompiler();
    String s = ssComp.compile( is, InputType.XLS );
    System.out.println( "=== Begin generated DRL ===" );
    System.out.println( s );
    System.out.println( "=== End generated DRL ===" );
  } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
}

, Drools. . , , DRL .

+1

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


All Articles