I think we need additional clarification on what you mean by “variables”. If 
you are referring to actual Groovy variables, you can enumerate them using the 
binding available in the context (see below). If you mean the attributes 
available on a flowfile, you can access them similarly. 

Find all variables starting with prefix: 

def varsStartingWithABC = this.binding.variables.findAll { k,v -> 
k.startsWith(“a.b.c”) }

Find all attributes starting with prefix:

def attrsStartingWithABC = flowfile.getAttributes().findAll { k,v -> 
k.startsWith(“a.b.c”) }



Andy LoPresto
[email protected]
[email protected]
He/Him
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69

> On Aug 7, 2020, at 2:11 AM, Saloni Udani <[email protected]> wrote:
> 
> Hi,
> We use NiFi 1.5.0.
> Our use case is to get particular key pattern variables (key and value) in 
> the groovy InvokeScriptedProcessor. E.g I want all variables whose key starts 
> with "a.b.c". By this I can write a generic logic on certain categories of 
> variables for further use.
> 
> Is there a way programmatically to get all variables with a certain key 
> pattern? Or for that matter is there a way programmatically to get all 
> available variables Map ? In NiFi 1.5.0 or further versions.
> 
> 
> Thanks
> Saloni Udani

Reply via email to