As an update, MVEL author fixed this and will do an MVEL release soon. When he does, we will test here and let you know, but you should be able to simply replace MVEL jar and it will work.

    []s
    Edson

2008/7/29 Edson Tirelli <tirelli@post.com>

   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

2008/7/23 Edson Tirelli <tirelli@post.com>:



   If you make your map available through a get, you can use simplified Map syntax like this:

public Map getStringParameters() {
        return stringParameter;
    }

   
io: InputObject ( stringParameters["propertyname"] == "something")

   []s
   Edson

2008/7/23 thomas kukofka <thomaskukofka@web.de>:
Hello ,

I just recognized, that this doesn't work. But it is possible to use plain Java code in the rule, also if-conditions and for and while-loops etc.. However more Java code makes the rule less readable and elegant.
Is there another possibility to use generic input objects?

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

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
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



--
Edson Tirelli
JBoss Drools Core Development
JBoss, a division of Red Hat @ www.jboss.com