You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Eric Secules <es...@gmail.com> on 2021/01/05 18:23:33 UTC

Dynamic Attribute Naming

Hello,

I was wondering if it's possible to name an attribute based on an EL
statement like

MyAttr.${fragment.index}

Then when flow files are merged back together all the attributes are
preserved.

Thanks,
Eric

Re: Dynamic Attribute Naming

Posted by Matt Burgess <ma...@apache.org>.
Eric,

I don't believe it's possible in NiFi per se, because you'd have to
set it via a property, and properties have unique and static names so
EL is not evaluated on them.  However you can use Groovy with
ExecuteScript to do this, check out [1] under the recipe "Add an
attribute to a flow file".

Regards,
Matt

[1] https://community.cloudera.com/t5/Community-Articles/ExecuteScript-Cookbook-part-1/ta-p/248922

On Tue, Jan 5, 2021 at 2:44 PM Eric Secules <es...@gmail.com> wrote:
>
> Hello,
>
> I was wondering if it's possible to name an attribute based on an EL statement like
>
> MyAttr.${fragment.index}
>
> Then when flow files are merged back together all the attributes are preserved.
>
> Thanks,
> Eric