[rules-users] Getting Current Date in LHS of a rule

sumatheja sumatheja at gmail.com
Wed May 9 06:44:23 EDT 2012


Thanks for the response. I will follow that.

On Wed, May 9, 2012 at 11:38 AM, Wolfgang Laun <wolfgang.laun at gmail.com>wrote:

> Don't do this: LHS code should not have any side effects and should
> not depend on the time a CE or constraint is evaluated.
>
> If your variable should represent a yyy-mm-dd 0:00:00, you should
> establish a global variable of type Date and initialize it after
> creating your session and before inserting any facts.
>
> -W
>
>
> On 09/05/2012, sumatheja <sumatheja at gmail.com> wrote:
> > Hi All,
> >         Can anyone tell me if there is a variable or standard way to get
> > the *current date* and compare with the java.util.Date. I'm trying write
> > the below rule but it doesn't work. It doesn't throw any error but the
> rule
> > is not at all fired in any case
> >
> > rule "new rule"
> > dialect "java"
> > when
> >     Message(*testDate < new Date()*)
> > then
> >     System.out.println("Test");
> > end
> > Do I have to insert a seperate fact which will contain the current date?
> > Thanks in advance.
> >
> > --
> > cheers
> > Sumatheja Dasararaju
> >
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
cheers
Sumatheja Dasararaju
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120509/bc5c91b0/attachment.html 


More information about the rules-users mailing list