Hi Thomas and all,
Drools delegates most of the complex expression evaluation to MVEL and it seems that it currently does not support variables as indexes in the map/collection simplified syntax. So, it will not work for now.
The good news is that we work very close with MVEL's author and if we kindly ask him (translation: offer him a few drinks and/or gifts) :) he usually adds support to such things.. ;) if so, just upgrading MVEL dependency jar will be enough to make it work, no need for a new drools release (hopefully). I will talk to him.
Meanwhile, tip for the curious: MVEL has a shell tool quite useful to play and check such things. Just run org.mvel.MVELSH having the MVEL jar in your classpath and you can play with it:
Welcome to MVEL!
mvel$ x = new java.util.HashMap()
OUT: {}
mvel$ x["a"] = "p"
OUT: p
mvel$ v="b"
OUT: b
mvel$ x[v]="q"
org.mvel.PropertyAccessException: unable to resolve property: failed to access property: <<v>> in: class java.util.HashMap
ERROR: unable to resolve token: v
mvel$ w=10
OUT: 10
mvel$ x[w]="r"
org.mvel.PropertyAccessException: unable to resolve property: failed to access property: <<w>> in: class java.util.HashMap
mvel$ x[10]="r"
OUT: r
mvel$ x
OUT: {a=p, 10=r}
mvel$
[]s
Edson
2008/7/24 thomas kukofka
<thomaskukofka@web.de>
Thanks,
but I've still Problems if I try to use
io: InputObject ( stringParameters[InputObject.
Parameter.ParameterName] == "something")
=>Field/method 'InputObject' not found for class 'com.rules.InputObject'Rule Compilation error
Parameter is an enum witch contains all allowed Parameters of InputObject
Kind Regards
Thomas
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
JBoss, a division of Red Hat @
www.jboss.com