Thank you, the regex method meets the requirement spot on. I was responding to 
the question about using the mime-types in a “key-value” lookup since that 
seemed to suggest hard coding the mime-types as attribute names (at least as I 
understood that suggestion).

Randall Wood

Please note: my work hours may not match your work hours. Please do not feel 
obligated to respond outside of your work hours.


From: ma...@burkon.cz <ma...@burkon.cz>
Date: Thursday, August 21, 2025 at 19:21
To: users@nifi.apache.org <users@nifi.apache.org>
Subject: Re: [EXTERNAL] Re: Use parameters in list to match "in" expression
OK,
Is this what you need for inspiration?

-----------------------------------------------------------------------------------------------------
1) Parrameter: "document-mime-types" with values separated by ENTER (\n), like 
this:

      application/pdf
      application/msword
      .. etc
-----------------------------------------------------------------------------------------------------
2) Update attribute procesor with new attribute:  "mime.list" with expression:

      ${#{document-mime-types}:replace('\n','|'):toLower()}

Note: attribute "mime.list" will be:  "application/pdf|application/msword" - 
thats mean data separate by pipe for regexp ready expression
-----------------------------------------------------------------------------------------------------
3) Route on attribute procesor with regexp rule:
      ${mime.type:toLower():matches('(${mime.list})')}
-----------------------------------------------------------------------------------------------------

Marek

P.S. Or you can direct setup document-mime-types parameter with data separated 
by pipe for regexp, like this:
      "application/pdf|application/msword|application/json|application/text"
and skip update attribute procesor


---------- Původní e-mail ----------
Od: Wood, Randall (US) <randall.w...@everfox.com>
Komu: users@nifi.apache.org <users@nifi.apache.org>
Datum: 22. 8. 2025 0:20:24
Předmět: Re: [EXTERNAL] Re: Use parameters in list to match "in" expression


I’m trying to make it possible that an external parameter provider can hold the 
mime-types so it’s easy to update the list of mime-types without changing the 
flow file itself.



Randall Wood



Please note: my work hours may not match your work hours. Please do not feel 
obligated to respond outside of your work hours.





From: Jens M. Kofoed <jmkofoed....@gmail.com>
Date: Thursday, August 21, 2025 at 15:57
To: users@nifi.apache.org <users@nifi.apache.org>
Subject: [EXTERNAL] Re: Use parameters in list to match "in" expression

What about using a simple key value lookup service. Where the mime type is the 
key, and the value could just be true or something.

If there is a match route it, if unmatched terminate.



Kind regards

Jens M. Kofoed





Den 21. aug. 2025 kl. 08.03 skrev ma...@burkon.cz:

Hello,

Im using for example this:



1)

Parrametr "list" with volues on new lines:

Hello

YES

test

srv1



2)

Update Attribute procesor:

"list" = ${#{fillter}:replace('\n','|'):toLower()}



3)

Route on Attibute:

"in_list" = ${body:toLower():matches('.*(${list}).*')}



Marek

---------- Původní e-mail ----------
Od: Wood, Randall (US) <randall.w...@everfox.com>
Komu: users@nifi.apache.org <users@nifi.apache.org>
Datum: 21. 8. 2025 1:39:02
Předmět: Use parameters in list to match "in" expression

I am using the `RouteOnAttribute` processor to route files based on mime type 
in a flow that I intend to be reusable but would like to either use a single 
parameter with the list of mime types or multiple parameters, one for each mime 
type (ideally without knowing the number of parameters ahead of time).



I am using the expression

${mime.type:in("application/pdf","application/msword")}

without issue, but can't get any of

            ${mime.type:in(“#{document-mime-type1}”)}

            ${mime.type:in(#{document-mime-type1})}

${mime.type:in("#{document-mime-type1}","#{document-mime-type2}")}

${mime.type:in(#{document-mime-type1},#{document-mime-type2})}

Or

${mime.type:in({document-mime-types})}

to work but can’t seem to find any documentation suggesting I should (or should 
not) expect parameters to work in this scenario.



The parameters are defined as:

document-mime-type1 = “application/pdf”

document-mime-type2 = “application/msword”

document-mime-types = “application/pdf,application/msword”



Any help would be appreciated,

Randall Wood (he, him, his)
Solutions Architect – Customer Engineering Solutions

Everfox



+1.703.840.2056

randall.w...@everfox.com<mailto:randall.w...@everfox.com>

www.everfox.com<http://www.everfox.com>


Reply via email to