[rules-users] Using 'from {x}.field' in DSL

Sandjaja, Dominik dominik.sandjaja at it-motive.de
Tue Jun 12 11:06:35 EDT 2012


I have the following Drools DSL "sentence":

    [when]The field {field} in the module {module} contains value
{value}=$a : {module} ( {field} != null)
          String( this.equalsIgnoreCase("{value}") ) from $a.{field}
where the `field` is a `Set` of Strings.

Now, if I have two of these sentences in one rule, it obviously won't
work as the variable `$a` occurs twice. So I wanted to improve the rule
to make the variable, well, variable:

    [when]The field {field} in the module {module} contains value
{value} as {a}={a} : {module} ( {field} != null)
          String( this.equalsIgnoreCase("{value}") ) from {a}.{field}

This doesn't work, I can't use the part `{a}.`, that breaks.

So, my questions are: Is there either a way to rewrite the rules or a
way to allow the `{variable}.` notation to work? Alternatively, is there
a `contains` operator which works case insensitive?

Thanks in advance
Dominik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120612/555a4815/attachment.html 


More information about the rules-users mailing list