Mike,

IIRC the "top-level" EL evaluator will go through a string finding EL
constructs and pass them into Query I think.  Also ReplaceText (for
some reason) is the only place I know of where you can quote something
and (if EL is present), the result is treated as a string literal.
Otherwise in NiFi Expression Language I believe a quoted construct on
its own is an attribute to be evaluated. You might want the following:

literal('${name}-${name:length()}')

or if that doesn't work, it might be because the Query has to be a
full EL construct so maybe you'd have to put the whole thing together
yourself:

Query.compile("${name}").evaluate(coordinates) + "-" +
Query.compile("${name:length()}")

I didn't try this out, and it's very possible my assumptions are not
spot-on, so if these don't work let me know and I'll take a closer
look.

Regards,
Matt




On Sat, Jun 2, 2018 at 6:30 PM, Mike Thomsen <[email protected]> wrote:
> I tried working with the EL package's Query object to try building
> something like this:
>
> def evaluate(String query, Map coordinates) {
>     def compiled = Query.compile(query)
>     compiled.evaluate(coordinates)
> }
>
> Which for [ name: "John Smith" ] and query '${name}-${name:length()}' I
> expected would return a string with both bracketed operations executed. It
> threw an exception saying unexpected token '-' at column 7.
>
> Am I missing something here?
>
> Thanks,
>
> Mike

Reply via email to