0
votes

I am pretty new to Drools and am trying to compile this simple.xls as decision table and get this very unhelpful compile error: [ERR 102] Line 8:1 mismatched input 'then' in rule "Patient Notification_11"

I have attached the xls along with the simple object that goes with it. I have read all the material on this and cannot figure out why I am getting the following error. I’d appreciated your help in advance. Specifically, I’d like to know if there is a way to check and see what goes on behind the scenes that causes this to error out. Also what is more important how do you debug the compiled version of the XLS like you do with .drl file if there is an error in the logic of decision table.

public static class PatientNotification {
    public static final int Notify = 1;
    public static final int EvalNotify = 0;

    private String message;
    private long ndc;
    private String  patientName;


    public String getPatientName() {
              return patientName;
        }

        public void setPatientName(String patientName) {
              this.patientName = patientName;
        }

        public long getNdc() {
              return ndc;
        }

        public void setNdc(long ndc) {
              this.ndc = ndc;
        }

        private int status;

    public String getMessage() {
        return this.message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public int getStatus() {
        return this.status;
    }

    public void setStatus(int status) {
        this.status = status;
    }
    public void setStatus(String sstatus) {
        if (sstatus.equals("Notify"))
              this.status=Notify;
        else if(sstatus.equals("EvalNotify"))
        this.status = EvalNotify;
        else
          this.status=-1; 

    }

}

XLS

1

1 Answers

3
votes

I think that the cell containing

m: PatientNotification

should be merged with its neighbour to the right so that both constraints are joined in the pattern based on this type. If this doesn't fix the problem, use the code below and report back.

To see what's going on in the spreadsheet compiler, use this method:

private void testSpreadsheet(){
  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();
  }
}