- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Is there a way for anyMatchingAttribute to work with references?
- Labels:
-
Apache NiFi
Created ‎11-10-2022 07:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As the question states I was wondering if it's possible to do something like:
anyMatchingAttribute(
${attributeToSearch}
).contains(${value})
Thank you
Created ‎11-15-2022 07:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Jacccs
An example or detailed description of yoru use case may be helpful in providing the bets guidance for you. While the NiFi Expression Language (NEL) function anyMatchingAttribute expects a java regular expression that searches and returns values for multiple FlowFile attributes, that does not appear to be what you need??? Your attribute "attributeToSearch" implies only a single specific FlowFile attribute is desire to be checked if it contains some "${value}". If this is correct, you would be able to use the following NEL:
${literal("${${attributeToSearch}}"):contains('${value}')}
For above NEL, let's assume a FlowFile with attribute "attributeToSearch" set to "username". A FlowFile attribute "username" set to "admin-matt". A FlowFile attribute "value" set to "admin".
The result of above NEL statement would be true
${$attributeToSearch}} would first resolve to ${username} which would then resolve to "admin-matt". That "admin-matt" string would be then passed to the NEL contains function which will to check to see if that string contains the string "admin" within it. The result is a boolean "true" or "false".
If you found that the provided solution(s) assisted you with your query, please take a moment to login and click Accept as Solution below each response that helped.
Thank you,
Matt
