Nick,

Here's a example slightly modified from my cookbook example (I'm not
sure that works with the array brackets, might need to use .get()
instead), this one is a full working script to log each attribute:

var flowFile = session.get()
if (flowFile != null) {
    var attrs = flowFile.getAttributes();
    for each (var attr in attrs.entrySet()) {
       log.info("Attribute " + attr.getKey() + " = " + attr.getValue());
  }
  session.transfer(flowFile, REL_SUCCESS);
}

Regards,
Matt


On Thu, Apr 12, 2018 at 2:18 PM, Nick Carenza
<[email protected]> wrote:
> Hey users,
>
> I am having trouble getting attributes from my flowfiles as described here
> https://community.hortonworks.com/articles/75032/executescript-cookbook-part-1.html.
>
> Does anyone have a working example they could share of getting and iterating
> through all of a flowfile's attributes in javascipt?
>
> Thanks.
> Nick

Reply via email to