[rules-users] Low Date question in drools

Wolfgang Laun wolfgang.laun at gmail.com
Thu Feb 9 12:50:28 EST 2012


Yes, it's strange.

Now, if there is a Person object person and you have, for instance,
   person.setDateOfBirth( new Date( -1899, 0, 1 ) )
then the rule for matching this oldster would be
   rule "Methuselah"
   when
      $p: Person( dateOfBirth == "1-Jan-1" )
   then
      ...

The Date constructor adds 1900 to the year.

-W



2012/2/9 Nancy Henggeler <Nancy.Henggeler at fblfinancial.com>

> It is a java date.  We use some java binding objects to build it.  Below
> is just a sampling of this.  The second entry below indicates what to name
> it in Java, it's java type, what DB2 table (cogentTable) and data field it
> is coming from (cogentField).  The snippets below might not help much.
>
>
> 1) bindHistory((ECDField) object.getElement("dateOfBirth"),
> this.getDateOfBirthHistory());
>
> 2)                <attribute name="dateOfBirth">
>                         <type>Date</type>
>                         <cogenTable>W1V0</cogenTable>
>                         <cogenField>BIRTH-DATE</cogenField>
>                         <description>Date Of Birth</description>
>                 </attribute>
>
>
>
> From:        Wolfgang Laun <wolfgang.laun at gmail.com>
> To:        Rules Users List <rules-users at lists.jboss.org>
> Date:        02/09/2012 11:00 AM
> Subject:        Re: [rules-users] Low Date question in drools
> Sent by:        rules-users-bounces at lists.jboss.org
> ------------------------------
>
>
>
> So what is the Java type of dateOfBirth, please?
> -W
>
> 2012/2/9 Nancy Henggeler <*Nancy.Henggeler at fblfinancial.com*<Nancy.Henggeler at fblfinancial.com>
> >
> Hello Laun,
>
> Thank you for your quick response.  This date is a date coming from a DB2
> date field and is valid in my incoming data.  Frankly, I am with you, why
> not null versus a silly low date as such, arggggh.  But since it is coming
> in as such do you know of a work around?
>
> Thank so much,
> Nancy
>
>
>
> From:        Wolfgang Laun <*wolfgang.laun at gmail.com*<wolfgang.laun at gmail.com>
> >
> To:        Rules Users List <*rules-users at lists.jboss.org*<rules-users at lists.jboss.org>
> >
> Date:        02/09/2012 10:31 AM
> Subject:        Re: [rules-users] Low Date question in drools
> Sent by:        *rules-users-bounces at lists.jboss.org*<rules-users-bounces at lists.jboss.org>
>  ------------------------------
>
>
>
> Why would you want to test for January 1st in year 1? This is not a
> value an object of type java.util.Date can represent. See that type's
> javadoc for details, but the epoch begins January 1, 1970.
>
> -W
>
>
> On 9 February 2012 17:19, Nancy Henggeler <*
> nancy.henggeler at fblfinancial.com* <nancy.henggeler at fblfinancial.com>>
> wrote:
> I have a simple rule where I want to bypass elements that have a low date
> but
> drools seems to be interpreting the date different then I am expecting.
> Drools statement and error follows:
>
> ClientSupplement ( dateOfBirth : dateOfBirth != null && != 0001-01-01)
>
> throws error -- Error: [Error: badly formatted number: For input string:
> "001-01-01"] [Near : {... 0001-01-01 ....}] ^ [Line: 1, Column: 1]
>
> How do I get drools to  understand this low date?  I have tried single,
> double, and no quotes around the low date and all result in a similiar
> error
> message.  Please Help!
>
> --
> View this message in context: *
> http://drools.46999.n3.nabble.com/Low-Date-question-in-drools-tp3729940p3729940.html
> *<http://drools.46999.n3.nabble.com/Low-Date-question-in-drools-tp3729940p3729940.html>
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list*
> **rules-users at lists.jboss.org* <rules-users at lists.jboss.org>*
> **https://lists.jboss.org/mailman/listinfo/rules-users*<https://lists.jboss.org/mailman/listinfo/rules-users>
> _______________________________________________
> rules-users mailing list*
> **rules-users at lists.jboss.org* <rules-users at lists.jboss.org>*
> **https://lists.jboss.org/mailman/listinfo/rules-users*<https://lists.jboss.org/mailman/listinfo/rules-users>
>   The information contained in this message may be privileged and
> confidential and protected from disclosure. If you are
> not the intended recipient of this message, you are hereby notified that
> any dissemination, distribution, or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, please notify us immediately by
> replying to the message, and please delete it from your computer.
>
>
> _______________________________________________
> rules-users mailing list*
> **rules-users at lists.jboss.org* <rules-users at lists.jboss.org>*
> **https://lists.jboss.org/mailman/listinfo/rules-users*<https://lists.jboss.org/mailman/listinfo/rules-users>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
> The information contained in this message may be privileged and confidential and protected from disclosure. If you are
> not the intended recipient of this message, you are hereby notified that any dissemination, distribution, or copying of this
> communication is strictly prohibited. If you have received this communication in error, please notify us immediately by
> replying to the message, and please delete it from your computer.
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120209/04632f19/attachment.html 


More information about the rules-users mailing list