[rules-users] rule creation

Edson Tirelli tirelli at post.com
Tue May 8 10:50:34 EDT 2007


   If you are using trunk:

rule Timer
when
    clock : AlarmClock( ( alarmTime.getHour() > 10 ) )
then
    // do something
end

    Please note that the double "(" are needed as the above is a predicate.

    If you are using 3.0.x, you need to bind the field first. So:

rule Timer
when
    clock : AlarmClock( $alarmTime : alarmTime -> ( $alarmTime.getHour() >
10 ) )
then
    // do something
end

     Hope it helps.

     []s
     Edson

2007/5/8, seeker <janko.dimitroff at dai-labor.de>:
>
>
> I'd like to build a rule which tests for a special property.
>
> rule "Timer"
>         when
>                 clock : AlarmClock( $time : alarmTime)
>         then
> // some consequences..
>
> the problem is the $time. I bound it to a variable so far.
> It is a complex object which I actually want to check for
> getAlarmTime().getHour() > 10
>
> I dont know how.
> I want the rule to fire if the hour of the alarmTime has reached a certain
> value.
> --
> View this message in context:
> http://www.nabble.com/rule-creation-tf3709922.html#a10376825
> Sent from the drools - user mailing list archive at Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070508/2697d56f/attachment.html 


More information about the rules-users mailing list