Hi Sandeep,

You can't compare two columns like that. You could do the following:
        when
                UcaseThreeDotOne($c: currentDate, $v: validityEndDate)
        eval($c.before($v))
 


On 10/31/06, Rayapudi Sandeep-mgb376 <[EMAIL PROTECTED]> wrote:

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




--
Steven Williams

Supervising Consultant

Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
[EMAIL PROTECTED]
www.objectconsulting.com.au

consulting | development | training | support
our experience makes the difference

Reply via email to