<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Routing on the basis of text/attribute of flowfile in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Routing-on-the-basis-of-text-attribute-of-flowfile/m-p/317568#M227230</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/87710"&gt;@midee&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not clearly following your use case.&lt;BR /&gt;&lt;BR /&gt;FlowFiles consist of two parts, FlowFile attributes/metadata and FlowFile content.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;You give example with "&lt;STRONG&gt;customefields_12345&lt;/STRONG&gt;" and "&lt;STRONG&gt;customefields_12346&lt;/STRONG&gt;".&lt;BR /&gt;Does this mean one FlowFile may have multiple "&lt;STRONG&gt;customefields_&amp;lt;some string&amp;gt;&lt;/STRONG&gt;" attributes assigned to it?&lt;BR /&gt;&lt;BR /&gt;How do you want to route FlowFiles where only some of those customfield attributes are null while others are not?&lt;BR /&gt;There are multiple ways to handle this using NiFi Expression Language (NEL) [1] and the routeOnAttribute [2] processor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;${anyMatchingAttribute("customfield.*"):isEmpty()}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Above would return "true" if &lt;STRONG&gt;ANY&lt;/STRONG&gt; of the NiFi FlowFile attributes starting with "customefield" is empty.&lt;BR /&gt;note:&amp;nbsp;&lt;SPAN&gt;The&amp;nbsp;&lt;/SPAN&gt;isEmpty&lt;SPAN&gt;&amp;nbsp;function returns&amp;nbsp;&lt;/SPAN&gt;true&lt;SPAN&gt;&amp;nbsp;if the Subject is null, does not contain any characters or contains only white-space (new line, carriage return, space, tab),&amp;nbsp;&lt;/SPAN&gt;false&lt;SPAN&gt;&amp;nbsp;otherwise.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;There is another NEL subjectless function that would return "true" only if &lt;STRONG&gt;ALL&lt;/STRONG&gt; FlowFileAttributes matching the Java regular expression were empty:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;${allMatchingAttributes("customfield.*"):isEmpty()}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp; Any FlowFile that does not return true for dynamic properties will get routed to the pre-existing relationship named "unmatched".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[1]&amp;nbsp;&lt;A href="https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html" target="_blank" rel="noopener"&gt;https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;[2]&amp;nbsp;&lt;A href="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" target="_blank" rel="noopener"&gt;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&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you found this addressed your query, please take a moment to login and click "Accept" on this solution.&lt;BR /&gt;Thank you,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 02 Jun 2021 14:52:09 GMT</pubDate>
    <dc:creator>MattWho</dc:creator>
    <dc:date>2021-06-02T14:52:09Z</dc:date>
    <item>
      <title>Routing on the basis of text/attribute of flowfile</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Routing-on-the-basis-of-text-attribute-of-flowfile/m-p/317411#M227156</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have many flow file which has multiple field like mentioned below&lt;/P&gt;&lt;P&gt;customefields_12345 : null&lt;/P&gt;&lt;P&gt;customefields_12346: { "welcome to this issue"}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to route these flow files on the condition :&lt;/P&gt;&lt;P&gt;if customfield is null --&amp;gt; navigate to other processor&lt;/P&gt;&lt;P&gt;if customfield is notnull or having some value other than null should be navigate to other processor.&lt;/P&gt;&lt;P&gt;Please let me know how to achieve this. early response will be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: customfield should be used rather than customfield_12345.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 May 2021 13:05:04 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Routing-on-the-basis-of-text-attribute-of-flowfile/m-p/317411#M227156</guid>
      <dc:creator>midee</dc:creator>
      <dc:date>2021-05-31T13:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: Routing on the basis of text/attribute of flowfile</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Routing-on-the-basis-of-text-attribute-of-flowfile/m-p/317568#M227230</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/87710"&gt;@midee&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not clearly following your use case.&lt;BR /&gt;&lt;BR /&gt;FlowFiles consist of two parts, FlowFile attributes/metadata and FlowFile content.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;You give example with "&lt;STRONG&gt;customefields_12345&lt;/STRONG&gt;" and "&lt;STRONG&gt;customefields_12346&lt;/STRONG&gt;".&lt;BR /&gt;Does this mean one FlowFile may have multiple "&lt;STRONG&gt;customefields_&amp;lt;some string&amp;gt;&lt;/STRONG&gt;" attributes assigned to it?&lt;BR /&gt;&lt;BR /&gt;How do you want to route FlowFiles where only some of those customfield attributes are null while others are not?&lt;BR /&gt;There are multiple ways to handle this using NiFi Expression Language (NEL) [1] and the routeOnAttribute [2] processor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;${anyMatchingAttribute("customfield.*"):isEmpty()}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Above would return "true" if &lt;STRONG&gt;ANY&lt;/STRONG&gt; of the NiFi FlowFile attributes starting with "customefield" is empty.&lt;BR /&gt;note:&amp;nbsp;&lt;SPAN&gt;The&amp;nbsp;&lt;/SPAN&gt;isEmpty&lt;SPAN&gt;&amp;nbsp;function returns&amp;nbsp;&lt;/SPAN&gt;true&lt;SPAN&gt;&amp;nbsp;if the Subject is null, does not contain any characters or contains only white-space (new line, carriage return, space, tab),&amp;nbsp;&lt;/SPAN&gt;false&lt;SPAN&gt;&amp;nbsp;otherwise.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;There is another NEL subjectless function that would return "true" only if &lt;STRONG&gt;ALL&lt;/STRONG&gt; FlowFileAttributes matching the Java regular expression were empty:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;${allMatchingAttributes("customfield.*"):isEmpty()}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp; Any FlowFile that does not return true for dynamic properties will get routed to the pre-existing relationship named "unmatched".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;[1]&amp;nbsp;&lt;A href="https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html" target="_blank" rel="noopener"&gt;https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;[2]&amp;nbsp;&lt;A href="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" target="_blank" rel="noopener"&gt;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&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you found this addressed your query, please take a moment to login and click "Accept" on this solution.&lt;BR /&gt;Thank you,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jun 2021 14:52:09 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Routing-on-the-basis-of-text-attribute-of-flowfile/m-p/317568#M227230</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2021-06-02T14:52:09Z</dc:date>
    </item>
  </channel>
</rss>

