Title: Usage of Date in Drools

Hi,

I am not able to compare if date A is before date B.
See the code below.

DroolsTest.java:
----------------------
public static class MyClass{
                Date regisDate, validityStartDate, validityEndDate, currentDate;
                void setCurrentDate(){
                        this.currentDate = new Date();
                        //System.out.println(this.currentDate);
                }
                void setValidityEndDate(Date x){
                        this.validityEndDate = x;
                }
                public Date getValidityEndDate(){
                        return this.validityEndDate;
                }
                public Date getCurrentDate(){
                        return this.currentDate;
                }
               
        }
Drools.drl
--------------
rule "check"
        when
                UcaseThreeDotOne( currentDate < validityEndDate )  -------->"A"
        then
                System.out.println("yes.. working");
End

At "A", error shown is,
org.drools.rule.InvalidRulePackage: Unable to return Declaration for identifier 'validityEndDate'

        at org.drools.rule.Package.checkValidity(Unknown Source)
        at org.drools.common.AbstractRuleBase.addPackage(Unknown Source)
        at com.sample.DroolsTest.readRule(DroolsTest.java:80)
        at com.sample.DroolsTest.main(DroolsTest.java:22)


In the above code, I am trying to check if validityEndDate is greater than currentDate.
Can anyone help me out?

Thnx,
Sandeep
Office: (080) 2601 0000 Extn: 6718
Direct: (080) 2601 6718

Reply via email to