&nbsp; Sanjay,<br><br>&nbsp; You almost got it right. If you are using 3.1M1 or later, you can do:<br><br>item : ItemVo ( itemStatusCode == ItemVo.STATUS_ACTIVE | == ItemVo.STATUS_DELETE )<br><br>&nbsp;&nbsp; field connective constraints use a single &quot;|&quot; or &quot;&amp;&quot;.
<br><br>&nbsp;&nbsp; []s<br>&nbsp;&nbsp; Edson<br><br><div><span class="gmail_quote">2007/4/4, Sanjay Singh - s0singh &lt;<a href="mailto:Sanjay.Singh@wal-mart.com">Sanjay.Singh@wal-mart.com</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
While this is working<br><br>when<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item : ItemVo(itemStatusCode == ItemVo.STATUS_INACTIVE) or<br>ItemVo(itemStatusCode == ItemVo.STATUS_DELETE)<br><br>Is this the right way of doing it ?<br><br>thanks<br><br>-----Original Message-----
<br>From: <a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a><br>[mailto:<a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a>] On Behalf Of Sanjay Singh -
<br>s0singh<br>Sent: Wednesday, April 04, 2007 2:12 PM<br>To: Rules Users List<br>Subject: [rules-users] Checking OR condition in LHS<br><br> when<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item : ItemVo ( itemStatusCode == ItemVo.STATUS_ACTIVE ||<br>ItemVo.STATUS_DELETE
 )<br> when<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item : ItemVo ( itemStatusCode == ItemVo.STATUS_ACTIVE ||<br>itemStatusCode == ItemVo.STATUS_DELETE )<br> when<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item : ItemVo ( (itemStatusCode == ItemVo.STATUS_ACTIVE ||<br>itemStatusCode == 
ItemVo.STATUS_DELETE) )<br> when<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item : ItemVo ( itemStatusCode == ItemVo.STATUS_ACTIVE || ==<br>ItemVo.STATUS_DELETE )<br> when<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item : ItemVo ( ( itemStatusCode == ItemVo.STATUS_ACTIVE ) || (<br>itemStatusCode == 
ItemVo.STATUS_DELETE ) )<br> when<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;item : ItemVo ( itemStatusCode == ItemVo.STATUS_ACTIVE OR<br>itemStatusCode == ItemVo.STATUS_DELETE )<br><br>All of these when conditions fail for me .. Can somebody send the syntax
<br>for two attributes check with OR condition ..<br><br>thanks<br><br><br>-----Original Message-----<br>From: <a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a><br>[mailto:<a href="mailto:rules-users-bounces@lists.jboss.org">
rules-users-bounces@lists.jboss.org</a>] On Behalf Of Sanjay Singh -<br>s0singh<br>Sent: Wednesday, April 04, 2007 8:13 AM<br>To: Rules Users List<br>Subject: RE: [rules-users] NullPointer in LHS dao calls ..<br><br>Thanks Rahul
<br>Yes i was setting it in working memory thats why it was working in RHS<br>.....<br><br>workingMemory.setGlobal(&quot;itemValidationDao&quot;, itemValidationDao);<br>and then in the DRL<br>global com.walmart.itemfile.item.dao.ItemValidationDao
<br>itemValidationDao;<br><br>I think i am missing something very basic ..<br><br>thanks<br><br>-----Original Message-----<br>From: <a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a>
<br>[mailto:<a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a>] On Behalf Of Rahul Phadnis<br>Sent: Tuesday, April 03, 2007 5:42 PM<br>To: Rules Users List<br>Subject: Re: [rules-users] NullPointer in LHS dao calls ..
<br><br>Did you set the global in the WorkingMemory?<br><br>You can do that using the API at<br><br><a href="http://labs.jboss.com/file-access/default/members/jbossrules/freezone/do">http://labs.jboss.com/file-access/default/members/jbossrules/freezone/do
</a><br>cs/3.0.5/apidocs/index.html<br>and yes that is for 3.0.5. I am sure there is an<br>equivalent for the version that you are using.<br><br>-Rahul<br><br><br>--- Sanjay Singh - s0singh &lt;<a href="mailto:Sanjay.Singh@wal-mart.com">
Sanjay.Singh@wal-mart.com</a>&gt;<br>wrote:<br><br>&gt; Since i could not get the earlier code running i<br>&gt; tried using eval in LHS<br>&gt; side for Dao calls but i keep on getting<br>&gt; NullPointerException ..<br>
&gt;<br>&gt; rule &quot;Item should have a valid status&quot;<br>&gt;<br>&gt; when<br>&gt;<br>&gt; ItemVo (statusCode : itemStatusCode != null)<br>&gt;<br>&gt; eval(<br>&gt; !itemValidationDao.isValidItemStatus(statusCode) )
<br>&gt;<br>&gt; then<br>&gt;<br>&gt;<br>errors.addValidationError(&quot;invalidtemStatusCode&quot;,&quot;Item<br>&gt; Status Code is<br>&gt; invalid &quot;);<br>&gt;<br>&gt; end<br>&gt;<br>&gt; Exception data: org.drools.RuntimeDroolsException
:<br>&gt; java.lang.NullPointerException<br>&gt;<br>&gt; at org.drools.rule.EvalCondition.isAllowed(Unknown<br>&gt; Source)<br>&gt;<br>&gt; at<br>&gt;<br>org.drools.reteoo.EvalConditionNode.assertTuple(Unknown<br>&gt; Source)
<br>&gt;<br>&gt; at<br>&gt;<br>org.drools.reteoo.LeftInputAdapterNode.createAndAssertTuple(Unknown<br>&gt; Source)<br>&gt;<br>&gt; at<br>&gt;<br>org.drools.reteoo.LeftInputAdapterNode.assertObject(Unknown<br>&gt; Source)<br>
&gt;<br>&gt; at<br>&gt;<br>org.drools.reteoo.ObjectSource.propagateAssertObject(Unknown<br>&gt; Source)<br>&gt;<br>&gt; Can somebody please help .. thanks<br>&gt;<br>&gt; ________________________________<br>&gt;<br>&gt; From: Sanjay Singh - s0singh
<br>&gt; Sent: Tuesday, April 03, 2007 11:01 AM<br>&gt; To: &#39;Anstis, Michael (M.)&#39;; Rules Users List<br>&gt; Subject: RE: Hi.<br>&gt;<br>&gt;<br>&gt;<br>&gt; Thanks for getting back to me Mike and Edson and<br>&gt; Sorry for the delayed
<br>&gt; response.<br>&gt;<br>&gt; I looked at your examples Mike and i felt better as<br>&gt; you said that we can<br>&gt; make dao calls in LHS .. And Edson suggested not to<br>&gt; be afraid of<br>&gt; suggesting the same constraint for more than one
<br>&gt; rule .. i guess i was<br>&gt; looking at it more procedural way and dint want any<br>&gt; repetition of those<br>&gt; conditions as the top level IF block but looks like<br>&gt; it won&#39;t hurt to<br>&gt; mention these constraints in all the rules related
<br>&gt; to this check ...so i<br>&gt; can include this check in all the rules .. hmm ..<br>&gt;<br>&gt; Here is a quick test i was trying to do for calling<br>&gt; the dao in LHS but<br>&gt; it fails .. what am i missing ..
<br>&gt;<br>&gt; package com.walmart.itemfile.item.rules<br>&gt;<br>&gt; import com.walmart.itemfile.item.vo.ItemVo;<br>&gt;<br>&gt; import com.walmart.itemfile.item.dao.ItemDao;<br>&gt;<br>&gt; import<br>&gt; com.walmart.itemfile.item.dao.ItemValidationDao
;<br>&gt;<br>&gt; import java.lang.String;<br>&gt;<br>&gt; global<br>&gt; com.walmart.itemfile.item.dao.ItemValidationDao<br>&gt; itemValidationDao;<br>&gt;<br>&gt; global com.walmart.itemfile.rules.ValidationErrorMap<br>
&gt; errors;<br>&gt;<br>&gt; rule &quot;Item should have a valid status&quot;<br>&gt;<br>&gt; when<br>&gt;<br>&gt; ItemVo( statusCode : itemStatusCode != null)<br>&gt;<br>&gt; ItemVo( statusCode == true ) from<br>&gt; itemValidationDao.isValidItemStatus
(statusCode) ..<br>&gt; my isValidItemStatus<br>&gt; method returns a boolean (not collection of codes)<br>&gt; and i need to check<br>&gt; if thats true than go to the RHS side .. is the line<br>&gt; in green even right<br>
&gt; ... in any case it does not recognize<br>&gt; itemValidationDao to begin with in<br>&gt; LHS side .. RHS same call works ..<br>&gt;<br>&gt; then<br>&gt;<br>&gt; errors.addValidationError(&quot;nullItemStatusCode&quot;,&quot;Item
<br>&gt; Status Code is<br>&gt; null&quot;);<br>&gt;<br>&gt; System.out.println(&quot;Item Base Defaults Called&quot; +<br>&gt; itemValidationDao.isValidItemStatus(statusCode));<br>&gt;<br>&gt; System.out.println(&quot;Item Status Code is null&quot;);
<br>&gt;<br>&gt; end<br>&gt;<br>&gt; Caused by: org.drools.rule.InvalidRulePackage:<br>&gt; unknown:32:28 Unexpected<br>&gt; token &#39;itemValidationDao&#39;<br>&gt;<br>&gt;<br>&gt; thanks for the help guys ..<br>&gt;<br>
&gt; Sanjay<br>&gt;<br>&gt; ________________________________<br>&gt;<br>&gt; From: Anstis, Michael (M.)<br>&gt; [mailto:<a href="mailto:manstis1@ford.com">manstis1@ford.com</a>]<br>&gt; Sent: Monday, March 26, 2007 8:57 AM
<br>&gt; To: Rules Users List<br>&gt; Cc: Sanjay Singh - s0singh<br>&gt; Subject: RE: Hi.<br>&gt;<br>&gt;<br>&gt; Hi Sanjay,<br>&gt;<br>&gt; To firstly answer your questions (in my opinion):<br>&gt; 1. You can&#39;t do nested whens in the LHS but you can
<br>&gt; do nested if / else<br>&gt; in the RHS (although you&#39;d fore go the benefits of a<br>&gt; RETE-based<br>&gt; inference engine; but possible if you&#39;ve got very<br>&gt; few rules and<br>&gt; facts...). I believe that there is work to have an
<br>&gt; &quot;otherwise&quot; statement<br>&gt; for rule syntax, how progressed this is and how it<br>&gt; will work I don&#39;t<br>&gt; know - over to Mark and team?!?<br>&gt; 2. Yes, take a look at the &quot;from&quot; statement (new for
<br>&gt; 3.1-M1, see<br>&gt;<br><a href="http://wiki.jboss.org/wiki/Wiki.jsp?page=3.1M1ReleaseNotes">http://wiki.jboss.org/wiki/Wiki.jsp?page=3.1M1ReleaseNotes</a>)<br>&gt; 3. Yes, take a look at rule-flow at<br>&gt;<br><a href="http://labs.jboss.com/portal/index.html?ctrl:cmd=render&amp;ctrl:window=defa">
http://labs.jboss.com/portal/index.html?ctrl:cmd=render&amp;ctrl:window=defa</a><br>&gt;<br>ult.blog.PrjBlogPortletWindowDefaultBlog&amp;project=jbossrules&amp;from=1&amp;link=<br>&gt;<br>RuleFlow_%28Kris_Verlaenen%29#RuleFlow_%28Kris_Verlaenen%29
<br>&gt; (although I<br>&gt; don&#39;t know if this is complete if 3.1-M1 - I think<br>&gt; it&#39;s not). Although I<br>&gt; don&#39;t think your rules really need rule-flow; you<br>&gt; just need to identify<br>&gt; and isolate the patterns (IF&#39;s) that would cause
<br>&gt; each &quot;Do Something&quot; to<br>&gt; be ran and create a rule for each - this has the<br>&gt; benefit of separating<br>&gt; each action into a separate rule making maintenance<br>&gt; a whole bunch<br>&gt; easier).
<br>&gt;<br>&gt; Anyway, I&#39;d try some rules like the following<br>&gt; examples (the rest are<br>&gt; based upon these):-<br>&gt;<br>&gt; Rule &quot;Rule 1&quot;<br>&gt; when<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; NewItem ( itemStatusCode == null)
<br>&gt; then<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; //do something<br>&gt; end<br>&gt;<br>&gt; Rule &quot;Rule 2&quot;<br>&gt; when<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; $u : User( )<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; $ni : NewItem ( $isc : itemStatusCode != null )<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; not Codes ( codes contains $isc ) from
<br>&gt; valDao.getValidItemStatusCodesForUser($u)<br>&gt; then<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; //Do something<br>&gt; end<br>&gt;<br>&gt; Rule &quot;Rule 3&quot;<br>&gt; when<br>&gt;<br>=== message truncated ===&gt;<br>_______________________________________________
<br>&gt; rules-users mailing list<br>&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users
</a><br>&gt;<br><br><br><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br>-----------------------------------------<br>*******************************************************************<br>*** This email and any files transmitted with it are confidential
<br>and intended solely for the individual or entity to whom they are<br>addressed. If you have received this email in error destroy it<br>immediately. ******************************************************<br>**************** Wal-Mart Confidential ****************************
<br>******************************************<br><br><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br>-----------------------------------------<br>*******************************************************************<br>*** This email and any files transmitted with it are confidential
<br>and intended solely for the individual or entity to whom they are<br>addressed. If you have received this email in error destroy it<br>immediately. ******************************************************<br>**************** Wal-Mart Confidential ****************************
<br>******************************************<br><br><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br>-----------------------------------------<br>*******************************************************************<br>*** This email and any files transmitted with it are confidential
<br>and intended solely for the individual or entity to whom they are<br>addressed. If you have received this email in error destroy it<br>immediately. ******************************************************<br>**************** Wal-Mart Confidential ****************************
<br>******************************************<br><br><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></div><br><br clear="all"><br>-- <br>&nbsp;&nbsp;Edson Tirelli<br>&nbsp;&nbsp;Software Engineer - JBoss Rules Core Developer<br>&nbsp;&nbsp;Office: +55 11 3124-6000<br>&nbsp;&nbsp;Mobile: +55 11 9218-4151
<br>&nbsp;&nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>