samd wrote:
It was my understanding based on other posts that was the required syntax for
dealing with with a Map in Drools. I'll try what you suggest.
  
var.map['key] is valid syntax.

But looking at your example "codes" is your map, so if you do codes.values you are returning a set. you can't use the square notation on a set.

Mark
Alessandro Terrinoni wrote:
  


    
Date: Fri, 10 Apr 2009 17:02:14 -0700
From: sdoyle_2@yahoo.com
To: rules-users@lists.jboss.org
Subject: [rules-users] Keep getting error trying to access value in hash
map.


I'm trying to extract the value from a hashmap after first extracting a
key
and I keep getting the same error.

Here is the rule information:

target: Target();
perm: PermissionCheck(target == target, action == "edit", granted ==
false);
primaryKey : TargetId(targetNum == 1) from target.codes.keySet();
primaryCode : TargetCode() from target.codes.values[primaryKey];
      
when you write target.codes.values[primaryKey] drools looks for a getter
method "getValues" in the object "codes" trying to return a field called
"values".

try to replace target.codes.values[primaryKey] with
target.codes.get(primaryKey)

Alessandro Terrinoni


    
Here is the error:

Caused by: javax.el.ELException: /layout/test.xhtml @25,111
rendered="#{s:hasPermission(target,'edit')}": org.mvel.CompileException:
unable to resolve property: values
        at
com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:76)
        at
javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:390)
        ... 61 more
Caused by: org.mvel.CompileException: unable to resolve property: values
        at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAcces
sorOptimizer.java:288)
        at
org.mvel.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAcce
ssorOptimizer.java:109)
        at
org.mvel.ast.VariableDeepPropertyNode.getReducedValueAccelerated(VariableDeepPropertyNode
.java:29)

Thanks
-- 
View this message in context:
http://www.nabble.com/Keep-getting-error-trying-to-access-value-in-hash-map.-tp22996482p22996482.html
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
      
_________________________________________________________________
Chiama gratis dal tuo PC! Parla su Messenger
http://clk.atdmt.com/GBL/go/140630369/direct/01/
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users