Pierre Villard created NIFI-4408:
------------------------------------

             Summary: Add a filter() EL function
                 Key: NIFI-4408
                 URL: https://issues.apache.org/jira/browse/NIFI-4408
             Project: Apache NiFi
          Issue Type: Improvement
          Components: Core Framework
            Reporter: Pierre Villard


It could be useful to have a filter function. Use case would be:

Input
'attribute' = "bfoo;bfaa;cfuu;bfii"

Expected output
'attribute' = "prefix_bfoo,prefix_bfaa,prefix_bfii"

With something like:

{code}
${allDelineatedValues("${attribute}", ";"):filter("^b"):replaceAll("(.*)", 
"prefix$1"):join(",")}
{code}

The "filter" function would act like "matches" but would return the subject 
element only if the subject element matches the regular expression. Or we could 
have a "filter" function allowing EL as argument to check a condition on each 
argument. That would certainly be more useful but not sure to see how the 
argument would be passed to the expression language. Something like:

{code}
${allDelineatedValues("${attribute}", 
";"):filter("${_:matches("^b")}"):replaceAll("(.*)", "prefix$1"):join(",")}
{code}




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to