@midee
I am not clearly following your use case.
FlowFiles consist of two parts, FlowFile attributes/metadata and FlowFile content.
You give example with "customefields_12345" and "customefields_12346".
Does this mean one FlowFile may have multiple "customefields_<some string>" attributes assigned to it?
How do you want to route FlowFiles where only some of those customfield attributes are null while others are not?
There are multiple ways to handle this using NiFi Expression Language (NEL) [1] and the routeOnAttribute [2] processor.
${anyMatchingAttribute("customfield.*"):isEmpty()}
Above would return "true" if ANY of the NiFi FlowFile attributes starting with "customefield" is empty.
note: The isEmpty function returns true if the Subject is null, does not contain any characters or contains only white-space (new line, carriage return, space, tab), false otherwise.
There is another NEL subjectless function that would return "true" only if ALL FlowFileAttributes matching the Java regular expression were empty:
${allMatchingAttributes("customfield.*"):isEmpty()}
With the RouteOnAttribute processor you create/add dynamic properties and each of those becomes a new routable relationship on the processor. if the NEL statement configured for that dynamic property returns true that FlowFile routes to that relationship. Any FlowFile that does not return true for dynamic properties will get routed to the pre-existing relationship named "unmatched".
[1] https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html
[2] https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.13.2/org.apache.nifi.processors.standard.RouteOnAttribute/index.html
If you found this addressed your query, please take a moment to login and click "Accept" on this solution.
Thank you,
Matt