i have this simple code
def values = [foo:5, bar:6]
def result = Eval.me("p", values, "${p.foo}+${p.bar}")
why it doesn’t work ?
i get a:
groovy.lang.MissingPropertyException: No such property: p for class: ConsoleScript7
Thanks for the help.
The Strings in your Groovy expression aren’t surrounded with double quotes, so Groovy isn’t treating them as a GString with expression support. Adding escaped double quotes around the expression and escaping the
$will give you a working result.Also, you could to one of the following, depending on if you want to output a String or and integer value:
or