<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
<SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Verdana','sans-serif'">Hi Pavel<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN><BR>
<SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Verdana','sans-serif'"> <o:p></o:p></SPAN><BR>
<SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Verdana','sans-serif'">I really don’t understand what do you mean. I guess you didn’t read complete thread carefully. Assigning endDate attribute in a variable and not using that variable in condition make no sense to me.<o:p></o:p></SPAN><BR>
<SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Verdana','sans-serif'"> <o:p></o:p></SPAN><BR>
<SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Verdana','sans-serif'">Shabbir<o:p></o:p></SPAN><BR>
<P> <BR></P>> Date: Wed, 24 Feb 2010 10:54:24 +0100<BR>> From: pavel.tavoda@gmail.com<BR>> To: rules-users@lists.jboss.org<BR>> Subject: Re: [rules-users] Comparing Date with || OR operator<BR>> <BR>> What about:<BR>> Membership ( $regDate : regDate)<BR>> Segment ($endDate : endDate, startDate < $regDate || startDate > endDate )<BR>> <BR>> Logically startDate > endDate doesn't make sense but it should work ;-)<BR>> <BR>> Pavel<BR>> <BR>> 2010/2/24 Shabbir Dhari <sdhari@hotmail.com>:<BR>> > I tried with some thing different and it worked but I don’t want this as I<BR>> > have many collections in my data structure.<BR>> ><BR>> > //this works<BR>> > Membership ( $regDate : regDate)<BR>> > Segment ( $endDate : endDate )<BR>> > Segment ( startDate < $regDate || startDate > $endDate )<BR>> ><BR>> > //this does NOT work<BR>> > Membership ( $regDate : regDate)<BR>> > Segment ($endDate : endDate, startDate < $regDate || startDate ><BR>> > $endDate )<BR>> ><BR>> > ________________________________<BR>> > From: sdhari@hotmail.com<BR>> > To: rules-users@lists.jboss.org<BR>> > Date: Tue, 23 Feb 2010 23:09:50 +0000<BR>> > Subject: Re: [rules-users] Comparing Date with || OR operator<BR>> ><BR>> > Segment ( $endDate : endDate, startDate < $regDate || startDate > $endDate )<BR>> > even does not work. I am using verstion 5.0.1. All dates are java.util.Date<BR>> > and values in sample fact are:<BR>> ><BR>> > regDate = Fri Aug 01 00:00:00 BST 2008<BR>> > startDate = Tue Sep 01 00:00:00 BST 2009<BR>> > endDate = Fri Jul 30 00:00:00 BST 2010<BR>> ><BR>> > Stack trace:<BR>> ><BR>> > java.lang.NullPointerException<BR>> > at org.drools.reteoo.LeftTuple.get(LeftTuple.java:265)<BR>> > at org.drools.reteoo.LeftTuple.get(LeftTuple.java:300)<BR>> > at<BR>> > org.drools.rule.VariableRestriction$ObjectVariableContextEntry.updateFromTuple(VariableRestriction.java:320)<BR>> > at<BR>> > org.drools.rule.AbstractCompositeConstraint$MultiFieldConstraintContextEntry.updateFromTuple(AbstractCompositeConstraint.java:305)<BR>> > at<BR>> > org.drools.common.SingleBetaConstraints.updateFromTuple(SingleBetaConstraints.java:119)<BR>> > at org.drools.reteoo.JoinNode.assertLeftTuple(JoinNode.java:109)<BR>> > at<BR>> > org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:117)<BR>> > at<BR>> > org.drools.reteoo.SingleLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(SingleLeftTupleSinkAdapter.java:78)<BR>> > at<BR>> > org.drools.reteoo.LeftInputAdapterNode.assertObject(LeftInputAdapterNode.java:142)<BR>> > at<BR>> > org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(SingleObjectSinkAdapter.java:42)<BR>> > at<BR>> > org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:185)<BR>> > at<BR>> > org.drools.reteoo.EntryPointNode.assertObject(EntryPointNode.java:146)<BR>> > at<BR>> > org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1046)<BR>> > at<BR>> > org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:1001)<BR>> > at<BR>> > org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:788)<BR>> > at<BR>> > org.drools.reteoo.ReteooStatelessSession.execute(ReteooStatelessSession.java:192)<BR>> > at<BR>> > au.gov.nsw.osr.zena.rules.AnnualRulesTester.main(AnnualRulesTester.java:57)<BR>> ><BR>> ><BR>> >> Date: Tue, 23 Feb 2010 12:54:46 +0100<BR>> >> From: wolfgang.laun@gmail.com<BR>> >> To: rules-users@lists.jboss.org<BR>> >> Subject: Re: [rules-users] Comparing Date with || OR operator<BR>> >><BR>> >> Please try this rewrite of the 2nd CE:<BR>> >> Segment ( $endDate : endDate, startDate < $regDate || startDate > $endDate<BR>> >> )<BR>> >> and report the outcome to the list, together with the Dools version<BR>> >> you are using.<BR>> >> Thank you.<BR>> >><BR>> >><BR>> >> 2010/2/23 dhari <sdhari@hotmail.com>:<BR>> >> > Hi Thomas<BR>> >> ><BR>> >> > Thanks your prompt reply. I am sure all three attributes are NOT null. I<BR>> >> > have tested them before sending question to mailing list. If you want,<BR>> >> > I can<BR>> >> > send complete sample code and you can try it at your end.<BR>> >> ><BR>> >> > Regards,<BR>> >> > Dhari<BR>> >> ><BR>> >> ><BR>> >> > ________________________________<BR>> >> > Date: Tue, 23 Feb 2010 02:50:08 -0800<BR>> >> > From: [hidden email]<BR>> >> > To: [hidden email]<BR>> >> > Subject: Re: Comparing Date with || OR operator<BR>> >> ><BR>> >> > If it works fine with an and operator then I’d imagine that startDate <<BR>> >> > $regDate returns false, with an && this would abort evaluation<BR>> >> > immediately<BR>> >> > but with an or it would mean that startDate > endDate is evaluated and<BR>> >> > so<BR>> >> > presumably it is this bit that is throwing the NPE. I’d imagine that<BR>> >> > the<BR>> >> > most likely reason for this would be that endDate is null.<BR>> >> ><BR>> >> ><BR>> >> ><BR>> >> > Try changing it too<BR>> >> ><BR>> >> > Segment ( startDate < $regDate || (endDate != null && startDate ><BR>> >> > endDate) )<BR>> >> ><BR>> >> > And see whether you loose the NPE.<BR>> >> ><BR>> >> ><BR>> >> ><BR>> >> > Thomas<BR>> >> ><BR>> >> ><BR>> >> ><BR>> >> > From: [hidden email] [mailto:[hidden email]] On Behalf Of dhari<BR>> >> > Sent: 23 February 2010 06:15<BR>> >> > To: [hidden email]<BR>> >> > Subject: [rules-users] Comparing Date with || OR operator<BR>> >> ><BR>> >> ><BR>> >> ><BR>> >> > The following code generates NPE in ReteTuple.java<BR>> >> ><BR>> >> > rule<BR>> >> ><BR>> >> > when<BR>> >> ><BR>> >> > Membership ( $regDate : regDate)<BR>> >> ><BR>> >> > Segment ( startDate < $regDate || startDate > endDate )<BR>> >> ><BR>> >> > then<BR>> >> ><BR>> >> > System.err.print(“Invalid start date”);<BR>> >> ><BR>> >> > end<BR>> >> ><BR>> >> > I am new in Drools and don’t know much about DRL scripting. It works<BR>> >> > fine I<BR>> >> > use && operator instead.<BR>> >> ><BR>> >> > ________________________________<BR>> >> ><BR>> >> > View this message in context: Comparing Date with || OR operator<BR>> >> > Sent from the Drools - User mailing list archive at Nabble.com.<BR>> >> ><BR>> >> > ________________________________<BR>> >> ><BR>> >> > **************************************************************************************<BR>> >> > This message is confidential and intended only for the addressee. If you<BR>> >> > have received this message in error, please immediately notify the<BR>> >> > [hidden<BR>> >> > email] and delete it from your system as well as any copies. The content<BR>> >> > of<BR>> >> > e-mails as well as traffic data may be monitored by NDS for employment<BR>> >> > and<BR>> >> > security purposes. To protect the environment please do not print this<BR>> >> > e-mail unless necessary.<BR>> >> ><BR>> >> > NDS Limited. Registered Office: One London Road, Staines, Middlesex,<BR>> >> > TW18<BR>> >> > 4EX, United Kingdom. A company registered in England and Wales.<BR>> >> > Registered<BR>> >> > no. 3080780. VAT no. GB 603 8808 40-00<BR>> >> ><BR>> >> > **************************************************************************************<BR>> >> ><BR>> >> > ________________________________<BR>> >> > This message is confidential and intended only for the addressee. If you<BR>> >> > have received this message in error, please immediately notify the<BR>> >> > [hidden<BR>> >> > email] and delete it from your system as well as any copies. The content<BR>> >> > of<BR>> >> > e-mails as well as traffic data may be monitored by NDS for employment<BR>> >> > and<BR>> >> > security purposes.<BR>> >> > To protect the environment please do not print this e-mail unless<BR>> >> > necessary.<BR>> >> ><BR>> >> > An NDS Group Limited company. www.nds.com<BR>> >> ><BR>> >> > _______________________________________________<BR>> >> > rules-users mailing list<BR>> >> > [hidden email]<BR>> >> > https://lists.jboss.org/mailman/listinfo/rules-users<BR>> >> ><BR>> >> ><BR>> >> > ________________________________<BR>> >> > View message @<BR>> >> ><BR>> >> > http://n3.nabble.com/Comparing-Date-with-OR-operator-tp347656p379447.html<BR>> >> > To unsubscribe from Drools - Java Rules Engine, click here.<BR>> >> ><BR>> >> > ________________________________<BR>> >> > Find your next place with Ninemsn property Looking for a place to rent,<BR>> >> > share or buy?<BR>> >> > ________________________________<BR>> >> > View this message in context: RE: Comparing Date with || OR operator<BR>> >> > Sent from the Drools - User mailing list archive at Nabble.com.<BR>> >> ><BR>> >> > _______________________________________________<BR>> >> > rules-users mailing list<BR>> >> > rules-users@lists.jboss.org<BR>> >> > https://lists.jboss.org/mailman/listinfo/rules-users<BR>> >> ><BR>> >> ><BR>> >><BR>> >> _______________________________________________<BR>> >> rules-users mailing list<BR>> >> rules-users@lists.jboss.org<BR>> >> https://lists.jboss.org/mailman/listinfo/rules-users<BR>> ><BR>> > ________________________________<BR>> > Browse profiles for free! View photos of singles in your area.<BR>> > ________________________________<BR>> > Get straight to the Point Find a great deal on your next car.<BR>> > _______________________________________________<BR>> > rules-users mailing list<BR>> > rules-users@lists.jboss.org<BR>> > https://lists.jboss.org/mailman/listinfo/rules-users<BR>> ><BR>> ><BR>> <BR>> _______________________________________________<BR>> rules-users mailing list<BR>> rules-users@lists.jboss.org<BR>> https://lists.jboss.org/mailman/listinfo/rules-users<BR>                                            <br /><hr />Get straight to the Point <a href='http://clk.atdmt.com/NMN/go/157637060/direct/01/' target='_new'>Find a great deal on your next car.</a></body>
</html>