<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<STYLE type=text/css>DIV {
        MARGIN: 0px
}
</STYLE>

<META content="MSHTML 6.00.2900.3132" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=850030710-07112007><FONT face=Arial 
color=#0000ff size=2>Hi,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=850030710-07112007><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=850030710-07112007><FONT face=Arial 
color=#0000ff size=2>Perhaps I'm reading too much into your example but I have a 
number of questions:-</FONT></SPAN></DIV>
<UL>
  <LI>
  <DIV align=left><SPAN class=850030710-07112007><FONT face=Arial color=#0000ff 
  size=2>I assume the rule is defined by the user? </FONT></SPAN></DIV></LI>
  <LI>
  <DIV align=left><SPAN class=850030710-07112007><FONT face=Arial color=#0000ff 
  size=2>Do you only have one instance of RaCdrMoc? </FONT></SPAN></DIV></LI>
  <LI>
  <DIV align=left><SPAN class=850030710-07112007><FONT face=Arial color=#0000ff 
  size=2>Why do you have a pattern for CDRError when this object is created by 
  the function? Is this needed in LHS?</FONT></SPAN></DIV></LI>
  <LI><SPAN class=850030710-07112007></SPAN><FONT face=Arial><FONT 
  color=#0000ff><FONT 
  size=2>Why&nbsp;do&nbsp;you&nbsp;have&nbsp;a&nbsp;pattern&nbsp;for&nbsp;LinkedList&nbsp;(unless&nbsp;you're&nbsp;asserting&nbsp;one&nbsp;LinkedList&nbsp;<SPAN 
  class=850030710-07112007>to hold the results </SPAN>-&nbsp;this&nbsp;<SPAN 
  class=850030710-07112007>c</SPAN>ould&nbsp;be&nbsp;a&nbsp;good&nbsp;candidate&nbsp;for&nbsp;a&nbsp;global)</FONT></FONT></FONT></LI>
  <LI><FONT><FONT color=#0000ff><FONT size=2><SPAN 
  class=850030710-07112007></SPAN></FONT></FONT></FONT><SPAN 
  class=850030710-07112007></SPAN><FONT face=Arial><FONT color=#0000ff><FONT 
  size=2><SPAN class=850030710-07112007>I assume</SPAN><SPAN 
  class=850030710-07112007>&nbsp;"cdrStructure : RaCdrStructure()" is where you 
  wanted to perform the <FONT 
  face="Courier New">(MyClass)mapOfObj.get("keyOfObj")</FONT> mentioned in your 
  earlier email but for now is redundant as it is in the 
  function?</SPAN></FONT></FONT></FONT></LI></UL>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=850030710-07112007>Also, what is relationship between a field structure 
and a field validation? (Your example structures contain validations like max 
length, optionality and datatype)?</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=850030710-07112007></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=850030710-07112007>I assume a field validation is a 
rule.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=850030710-07112007></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=850030710-07112007>Thanks,</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=850030710-07112007></SPAN></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=850030710-07112007>Mike</SPAN></FONT></FONT></FONT><FONT face=Arial><FONT 
color=#0000ff><FONT size=2><SPAN class=850030710-07112007>&nbsp;&nbsp; 
</SPAN></FONT></FONT></FONT><BR></DIV>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
  <HR tabIndex=-1>
  </DIV>
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT 
  face=Tahoma size=2><B>From:</B> rules-users-bounces@lists.jboss.org 
  [mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of 
  </B>shaz<BR><B>Sent:</B> 07 November 2007 02:49<BR><B>To:</B> Rules Users 
  List<BR><B>Subject:</B> Re: [rules-users] Accessing maps (hashmaps) keys and 
  values in rules<BR></FONT><BR></DIV>
  <DIV></DIV>
  <DIV style="FONT-SIZE: 10pt; FONT-FAMILY: arial,helvetica,sans-serif">
  <DIV 
  style="FONT-SIZE: 10pt; FONT-FAMILY: arial,helvetica,sans-serif">Hi,<BR><BR>I'll 
  try to explain my case...<BR>I have an Object which has around 90 fields. For 
  each of these fields, there can be unlimited validations that needs to be 
  made. By unlimited, I mean that the user can create rules for each specific 
  field. So not all rules are applicable to all fields. The objects I'm placing 
  on the Map are the field structure of the 90 fields. These are things like the 
  maxlength, mandatory/optional, alphanumeric/numeric of each field.<BR>Here is 
  a sample code wherein I just used the Map in the <SPAN 
  style="FONT-STYLE: italic">then 
  clause...</SPAN><BR><BR>==================<BR><BR><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">global 
  java.util.HashMap recordTypeMap;</SPAN><BR 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">global 
  java.util.TreeMap structMap;</SPAN><BR 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">global 
  java.util.ArrayList structList;</SPAN><BR><BR><FONT size=1><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">function CDRError 
  setCDRError(RaCdrMoc cdr, CDRError cdrError, TreeMap structMap, </SPAN><BR 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  String fieldName, String errorType, String editedValue, boolean autoCorrected) 
  {</SPAN><BR style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><BR 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  cdrError = new CDRError();</SPAN><BR 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  </SPAN><BR style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  cdrError.setCdrUploadId(cdr.getId().getCdruploadId());</SPAN><BR 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  cdrError.setCdrNo(cdr.getId().getCdrNo());</SPAN><BR 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  cdrError.setCdrType(0);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; </SPAN><BR 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  </SPAN><BR style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  RaCdrStructure cdrStructure = new RaCdrStructure();</SPAN><BR 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  cdrStructure = (RaCdrStructure) structMap.get(fieldName);&nbsp;&nbsp;&nbsp; 
  </SPAN><BR style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  cdrError.setFieldNo(cdrStructure.getId().getFieldNo());&nbsp;&nbsp;&nbsp; 
  </SPAN><BR style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  cdrError.setErrorType(errorType);&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
  </SPAN><BR style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  cdrError.setEditedFieldValue(editedValue);</SPAN><BR 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  cdrError.setAutoCorrected(autoCorrected);&nbsp;&nbsp;&nbsp; </SPAN><BR 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  </SPAN><BR style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  return cdrError;</SPAN><BR 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">}</SPAN><BR 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;</SPAN><BR 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">rule "MOC Check 
  Missing Filename"</SPAN><BR 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  when</SPAN><BR style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; cdr : RaCdrMoc(mocflnm == ""); //this is the Object with 90 
  fields</SPAN><BR 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; cdrError : CDRError(); //the resulting object that will be 
  added to the list</SPAN><BR 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; errorList : LinkedList(); //all errors will be placed 
  here</SPAN><BR style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; cdrStructure : RaCdrStructure();</SPAN><BR 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  then</SPAN><BR style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; System.out.println("========No filename================"); 
  &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; </SPAN><BR 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; cdr.setMocflnm("Testfile.csv");&nbsp;&nbsp;&nbsp; 
  </SPAN><BR style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; cdrError = setCDRError(cdr, cdrError, structMap, "MOCFLNM", 
  "01", "Testfile.csv", true);</SPAN><BR 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; errorList.addLast(cdrError);</SPAN><BR 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif"><SPAN 
  style="FONT-FAMILY: courier,monaco,monospace,sans-serif">end</SPAN></FONT><BR>=========================<BR><BR>My 
  other rules would require the accessing of Hashmaps from the <SPAN 
  style="FONT-STYLE: italic">when </SPAN>clause. IWould there be a need to 
  change my data model <BR><BR>Thanks a lot,<BR><BR>shaz<BR><BR>
  <DIV 
  style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman,new york,times,serif">----- 
  Original Message ----<BR>From: "Anstis, Michael (M.)" 
  &lt;manstis1@ford.com&gt;<BR>To: Rules Users List 
  &lt;rules-users@lists.jboss.org&gt;<BR>Sent: Friday, November 2, 2007 5:20:38 
  PM<BR>Subject: RE: [rules-users] Accessing maps (hashmaps) keys and values in 
  rules<BR><BR>
  <STYLE type=text/css>DIV {
        MARGIN: 0px
}
</STYLE>

  <DIV dir=ltr align=left><SPAN class=448075808-02112007><FONT face=Arial 
  color=#0000ff size=2>IMHO you should still think about putting the Map values 
  into working memory.</FONT></SPAN></DIV>
  <DIV dir=ltr align=left><SPAN class=448075808-02112007><FONT face=Arial 
  color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV dir=ltr align=left><SPAN class=448075808-02112007><FONT face=Arial 
  color=#0000ff size=2>This would both simplify your rules and make their 
  execution faster (eval cannot be indexed, if I remember 
  correctly).</FONT></SPAN></DIV>
  <DIV dir=ltr align=left><SPAN class=448075808-02112007><FONT face=Arial 
  color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV dir=ltr align=left><SPAN class=448075808-02112007><FONT face=Arial 
  color=#0000ff size=2>You might need to adapt your data model representation 
  into one that is more efficient for use in a RETE network.</FONT></SPAN></DIV>
  <DIV dir=ltr align=left><SPAN class=448075808-02112007><FONT face=Arial 
  color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV dir=ltr align=left><SPAN class=448075808-02112007><FONT face=Arial 
  color=#0000ff size=2>Can you explain your use case to help understand? Unless 
  you have very good reason to keep the facts in the Map your life will be more 
  difficult than it need be.</FONT></SPAN></DIV>
  <DIV dir=ltr align=left><SPAN class=448075808-02112007><FONT face=Arial 
  color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV dir=ltr align=left><SPAN class=448075808-02112007><FONT face=Arial 
  color=#0000ff size=2>An "eval" returns a boolean indiciating whether the 
  "pattern" matched and therefore, whilst you can reference other bound LHS 
  facts, you cannot bind other objects to variables.</FONT></SPAN></DIV>
  <DIV dir=ltr align=left><SPAN class=448075808-02112007><FONT face=Arial 
  color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV dir=ltr align=left><SPAN class=448075808-02112007><FONT face=Arial 
  color=#0000ff size=2>Thanks,</FONT></SPAN></DIV>
  <DIV dir=ltr align=left><SPAN class=448075808-02112007><FONT face=Arial 
  color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV dir=ltr align=left><SPAN class=448075808-02112007><FONT face=Arial 
  color=#0000ff size=2>Mike</FONT></SPAN></DIV><BR>
  <BLOCKQUOTE style="MARGIN-RIGHT: 0px">
    <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
    <HR tabIndex=-1>
    <FONT face=Tahoma size=2><B>From:</B> rules-users-bounces@lists.jboss.org 
    [mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of 
    </B>shaz<BR><B>Sent:</B> 02 November 2007 02:32<BR><B>To:</B> Rules Users 
    List<BR><B>Subject:</B> Re: [rules-users] Accessing maps (hashmaps) keys and 
    values in rules<BR></FONT><BR></DIV>
    <DIV></DIV>
    <DIV style="FONT-SIZE: 10pt; FONT-FAMILY: arial,helvetica,sans-serif">
    <DIV style="FONT-SIZE: 10pt; FONT-FAMILY: arial,helvetica,sans-serif">Hi, 
    <BR><BR>I am placing objects in the Hashmap that were retrieved from the 
    database. There are currently a hundred objects that I'm storing in the 
    HashMap. I just made a simple example earlier :) . What works for me now is 
    putting the getting of the values in the eval(). However, I don't know how 
    to assign the values that I've taken from the Map.<BR><BR>eval( ( 
    (MyClass)mapOfObj.get("keyOfObj")).getId() &gt; 30);<BR><BR>How do I assign 
    (MyClass)mapOfObj.get("keyOfObj") to a 
    variable?<BR><BR><BR>tnx,<BR><BR>shaz<BR><BR><BR>
    <DIV 
    style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman,new york,times,serif">----- 
    Original Message ----<BR>From: "Anstis, Michael (M.)" 
    &lt;manstis1@ford.com&gt;<BR>To: Rules Users List 
    &lt;rules-users@lists.jboss.org&gt;<BR>Sent: Friday, November 2, 2007 
    12:17:51 AM<BR>Subject: RE: [rules-users] Accessing maps (hashmaps) keys and 
    values in rules<BR><BR>
    <DIV dir=ltr align=left><SPAN class=886131616-01112007><FONT face=Arial 
    color=#0000ff size=2>By way of example (if you misunderstand how the rule 
    engine should be used):-</FONT></SPAN></DIV>
    <DIV dir=ltr align=left><SPAN class=886131616-01112007><FONT face=Arial 
    color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
    <DIV><FONT color=#0000ff><FONT size=2><FONT face="Courier New">rule 
    chkobj<BR>when<BR><SPAN class=886131616-01112007>&nbsp;&nbsp;&nbsp; $o : 
    </SPAN>MyClass(<SPAN class=886131616-01112007> </SPAN>id == "1"<SPAN 
    class=886131616-01112007>,&nbsp;</SPAN><SPAN 
    class=886131616-01112007>n</SPAN>ame == "name"<SPAN 
    class=886131616-01112007> )</SPAN></FONT></FONT></FONT></DIV>
    <DIV><SPAN class=886131616-01112007></SPAN><SPAN 
    class=886131616-01112007></SPAN><FONT color=#0000ff size=2><FONT 
    face="Courier New">t<SPAN 
    class=886131616-01112007>hen</SPAN></FONT></FONT></DIV>
    <DIV><FONT size=+0><SPAN class=886131616-01112007></SPAN><FONT 
    color=#0000ff><FONT face="Courier New" size=2><SPAN 
    class=886131616-01112007>&nbsp;&nbsp;&nbsp; //Do something 
    else</SPAN></FONT></FONT></FONT></DIV>
    <DIV><FONT size=+0><FONT size=+0><SPAN class=886131616-01112007></SPAN><FONT 
    color=#0000ff><FONT face="Courier New" size=2><SPAN 
    class=886131616-01112007>&nbsp;&nbsp;&nbsp; 
    $o.doSomething();</SPAN></FONT></FONT></FONT></FONT></DIV>
    <DIV><FONT size=+0><FONT size=+0><FONT size=+0><FONT size=+0><FONT 
    size=+0><FONT size=+0><SPAN class=886131616-01112007></SPAN><SPAN 
    class=886131616-01112007></SPAN><FONT face="Courier New" color=#0000ff 
    size=2>e<SPAN 
    class=886131616-01112007>nd</SPAN></FONT></FONT></FONT></FONT></FONT></FONT></FONT></DIV><BR>
    <BLOCKQUOTE style="MARGIN-RIGHT: 0px">
      <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
      <HR tabIndex=-1>
      <FONT face=Tahoma size=2><B>From:</B> rules-users-bounces@lists.jboss.org 
      [mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of </B>Edson 
      Tirelli<BR><B>Sent:</B> 01 November 2007 15:48<BR><B>To:</B> Rules Users 
      List<BR><B>Subject:</B> Re: [rules-users] Accessing maps (hashmaps) keys 
      and values in rules<BR></FONT><BR></DIV>
      <DIV></DIV><BR>&nbsp;&nbsp; Shaz,<BR><BR>&nbsp;&nbsp; We strongly advise 
      you to move to 4.0.3, but this is not related to your problem. 
      <BR>&nbsp;&nbsp; I think you are misunderstanding something. Why are you 
      using the global map to store your fact? Simply insert it into the working 
      memory and it will work fine. <BR><BR>&nbsp;&nbsp; []s<BR>&nbsp;&nbsp; 
      Edson<BR><BR><BR>
      <DIV><SPAN class=gmail_quote>2007/11/1, Shaz Tumulak &lt;<A 
      href="mailto:shauii@yahoo.com" target=_blank rel=nofollow 
      ymailto="mailto:shauii@yahoo.com">shauii@yahoo.com</A>&gt;:</SPAN> 
      <BLOCKQUOTE class=gmail_quote 
      style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid"><BR>Hi,<BR><BR>I 
        can't seem to make this syntax work in Drools 4.0.2. Pls. see my 
        sample<BR>code 
        below.<BR>________________________________________<BR>class MyClass 
        {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String 
        id;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;String 
        name;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MyClass(String 
        id, String 
        name){<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A 
        href="http://this.id" target=_blank rel=nofollow>this.id</A> = 
        id;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A 
        href="http://this.name" target=_blank rel=nofollow>this.name</A> = 
        name;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;getter, 
        setter methods 
        <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:<BR>}<BR><BR>MyClass 
        obj = new MyClass("1"", "name");<BR><BR>TreeMap&lt;String, MyClass&gt; 
        mapOfObj = new TreeMap&lt;String, 
        MyClass&gt;();<BR>mapOfObj.put("keyOfObj", obj); 
        <BR>________________________________________<BR><BR>DRL 
        file<BR>-------<BR><BR>global java.util.TreeMap mapOfObj;<BR><BR>rule 
        chkobj<BR>when<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;obj : 
        MyClass(mapOfObj["keyOfObj"].id == 
        "1");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;eval(obj.getName() 
        == "name");<BR>________________________________________<BR><BR>I'm 
        getting this error: 
        org.drools.RuntimeDroolsException:<BR>java.lang.NullPointerException<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at 
        <BR>org.drools.rule.EvalCondition.isAllowed(EvalCondition.java:76)<BR><BR>Is 
        my syntax correct and has someone used this in 4.0.2 or should I move 
        on<BR>to Drools 4.0.3? Thanks in 
        advance.<BR><BR>Regards,<BR><BR>shaz<BR><BR><BR>Edson Tirelli-3 
        wrote:<BR>&gt;<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;Denis,<BR>&gt;<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;If 
        you are using latest build from trunk (I'm not sure it already 
        works<BR>&gt; in MR3), you can use a simplified MVEL 
        syntax:<BR>&gt;<BR>&gt; when <BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; Person( 
        address["business"].phone == "99999999" )<BR>&gt; 
        then<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp; ...<BR>&gt; 
        end<BR>&gt;<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;Although, the above will be 
        converted into an inline-eval. Not as bad<BR>&gt; as <BR>&gt; a top 
        level eval, but still more costly then using regular 
        fields.<BR>&gt;<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;[]s<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;Edson<BR>&gt;<BR>&gt; 
        2007/7/19, Ryan, Dennis (Dennis) &lt;<A 
        href="mailto:dennisryan@avaya.com" target=_blank rel=nofollow 
        ymailto="mailto:dennisryan@avaya.com">dennisryan@avaya.com 
        </A>&gt;:<BR>&gt;&gt;<BR>&gt;&gt;&nbsp;&nbsp;We are using Maps 
        (HashMaps) in our rules and the only way we have found<BR>&gt;&gt; to 
        access keys and values in the Map in the "when" clauses is thru use 
        on<BR>&gt;&gt; eval() which I know is a big no-no by rules purists. Is 
        there a better <BR>&gt;&gt; way,<BR>&gt;&gt; maybe some shorthand I'm 
        not familiar with to deal with Maps in the when<BR>&gt;&gt; 
        clause?<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;&gt; 
        Thanks,<BR>&gt;&gt;<BR>&gt;&gt; Dennis<BR>&gt;&gt; <BR>&gt;&gt; 
        _______________________________________________<BR>&gt;&gt; rules-users 
        mailing list<BR>&gt;&gt; <A href="mailto:rules-users@lists.jboss.org" 
        target=_blank rel=nofollow 
        ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR>&gt;&gt; 
        <A href="https://lists.jboss.org/mailman/listinfo/rules-users" 
        target=_blank 
        rel=nofollow>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR>&gt;&gt;<BR>&gt;&gt;<BR>&gt;<BR>&gt;<BR>&gt; 
        --<BR>&gt;&nbsp;&nbsp; Edson Tirelli<BR>&gt;&nbsp;&nbsp; Software 
        Engineer - JBoss Rules Core Developer<BR>&gt;&nbsp;&nbsp; Office: +55 11 
        3529-6000 <BR>&gt;&nbsp;&nbsp; Mobile: +55 11 
        9287-5646<BR>&gt;&nbsp;&nbsp; JBoss, a division of Red Hat @ <A 
        href="http://www.jboss.com" target=_blank 
        rel=nofollow>www.jboss.com</A><BR>&gt;<BR>&gt; 
        _______________________________________________<BR>&gt; rules-users 
        mailing list <BR>&gt; <A href="mailto:rules-users@lists.jboss.org" 
        target=_blank rel=nofollow 
        ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR>&gt; 
        <A href="https://lists.jboss.org/mailman/listinfo/rules-users" 
        target=_blank 
        rel=nofollow>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR>&gt; 
        <BR>&gt;<BR><A href="mailto:shauii@yahoo.com" target=_blank rel=nofollow 
        ymailto="mailto:shauii@yahoo.com">shauii@yahoo.com</A><BR>--<BR>View 
        this message in context: <A 
        href="http://www.nabble.com/Accessing-maps-%28hashmaps%29-keys-and-values-in-rules-tf4112197.html#a13524477" 
        target=_blank 
        rel=nofollow>http://www.nabble.com/Accessing-maps-%28hashmaps%29-keys-and-values-in-rules-tf4112197.html#a13524477 
        </A><BR>Sent from the drools - user mailing list archive at <A 
        href="http://Nabble.com" target=_blank 
        rel=nofollow>Nabble.com</A>.<BR><BR>_______________________________________________<BR>rules-users 
        mailing list<BR><A href="mailto:rules-users@lists.jboss.org" 
        target=_blank rel=nofollow 
        ymailto="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR><A 
        href="https://lists.jboss.org/mailman/listinfo/rules-users" 
        target=_blank 
        rel=nofollow>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 
      3529-6000<BR>&nbsp;&nbsp;Mobile: +55 11 9287-5646<BR>&nbsp;&nbsp;JBoss, a 
      division of Red Hat @ <A href="http://www.jboss.com" target=_blank 
      rel=nofollow>www.jboss.com</A> </BLOCKQUOTE></DIV><BR></DIV></DIV><BR>
    <HR SIZE=1>
    <FONT face=Arial size=-1>Platonic friends of the opposite sex - the real 
    deal?<BR>Be a better buddy<BR><A 
    href="http://ph.answers.yahoo.com/dir/index;_ylt=AsCq4OcgSoQ9qZZdke2cnGhL5Qt.;_ylv=3?link=over&amp;sid=396545433" 
    target=_blank rel=nofollow>Find out at Yahoo! Answers</A></FONT> 
  </BLOCKQUOTE></DIV><BR></DIV></DIV><BR>
  <HR SIZE=1>
  <FONT face=Arial size=-1>Tired of spam? Yahoo! Mail has the best spam 
  protection around<BR><A 
  href="http://sg.rd.yahoo.com/mail/ph/footer/def/*http://ph.mail.yahoo.com ">http://ph.mail.yahoo.com</A></FONT></BLOCKQUOTE></BODY></HTML>