<?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: Count the number of FlowFiles that have the same filename attribute in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Count-the-number-of-FlowFiles-that-have-the-same-filename/m-p/182681#M80598</link>
    <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929"&gt;@Shu&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Thanks for your suggest solution, but it doesn't work in my set up. I might have 100 flow files coming out of duplicate relationship of DetectDuplicate processor. 50 of them will have A.txt filename while the rest will be B.txt. The expected output would be A (1).txt, ..., A (50).txt and B (1).txt, .., B(50).txt. Since the number of flow files is not a fixed number, I can't really reset the state value. They all have the same ${segment.original.filename} value by the way. If there are another 10 flow files with A.txt coming out of DetectDuplicate processor with a different ${segment.original.filename} value, then these flow file should be named from 1 to 20.&lt;/P&gt;</description>
    <pubDate>Fri, 13 Jul 2018 02:25:12 GMT</pubDate>
    <dc:creator>hoavuong1991</dc:creator>
    <dc:date>2018-07-13T02:25:12Z</dc:date>
    <item>
      <title>Count the number of FlowFiles that have the same filename attribute</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Count-the-number-of-FlowFiles-that-have-the-same-filename/m-p/182679#M80596</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a number of flow files coming to the MergeContent processor to merge them into a zip file. However, some of the flow files have the same name which causes duplicate entry error. I want to add a counter value to their filename attribute in order to merge them (ex. A.txt (1), A.txt (2), etc.). &lt;/P&gt;&lt;P&gt;I used DetectDuplicate processor to separate the flow files with duplicate filename, not sure how to add a counter variable to their filename attribute. Can anyone give me an idea how to solve this?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2018 07:24:04 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Count-the-number-of-FlowFiles-that-have-the-same-filename/m-p/182679#M80596</guid>
      <dc:creator>hoavuong1991</dc:creator>
      <dc:date>2018-07-12T07:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: Count the number of FlowFiles that have the same filename attribute</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Count-the-number-of-FlowFiles-that-have-the-same-filename/m-p/182680#M80597</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/87247/hoavuong1991.html" nodeid="87247" target="_blank"&gt;@Hoa Vuong&lt;/A&gt;
&lt;/P&gt;&lt;P&gt;Feed the duplicate relation from DetectDuplicate processor to Update attribute processor with nextInt subject less function&lt;/P&gt;&lt;P&gt;Add new property as&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;filename
&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;${filename}(${nextInt()})&lt;/PRE&gt;&lt;P&gt;By using above expression will add nextint to the filename&lt;/P&gt;&lt;P&gt;For more reference look into &lt;A href="https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#nextint" target="_blank" rel="nofollow noopener noreferrer"&gt;this&lt;/A&gt; link regarding nextInt() function usage.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(Or)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;By storing state in UpdateAttribute processor&lt;/P&gt;&lt;P&gt; add new property as&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;theCount
&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;${getStateValue("theCount"):plus(1)}&lt;/PRE&gt;&lt;P&gt;Use &lt;STRONG&gt;another update attribute processor &lt;/STRONG&gt;to add theCount attribute to filename.&lt;/P&gt;&lt;P&gt;refer to &lt;A href="https://nifi.apache.org/docs/nifi-docs/html/expression-language-guide.html#getstatevalue" target="_blank" rel="nofollow noopener noreferrer"&gt;this&lt;/A&gt; regarding getStateValue funtion usage.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="79458-state.png" style="width: 1432px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/19124iD274EF3288F2AC9E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="79458-state.png" alt="79458-state.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;add new property as &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;filename&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;${filename}(${theCount})&lt;/PRE&gt;&lt;P&gt;By using this approach you can reset your state value to 0 once it reaches to your threshhold value(like if value is 100 then set to 0 again) and refer to &lt;A href="https://community.hortonworks.com/questions/157214/resetting-an-attribute-seq-in-updateattribute-proc.html" target="_blank" rel="nofollow noopener noreferrer"&gt;this&lt;/A&gt; link regarding reset the value.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 08:49:55 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Count-the-number-of-FlowFiles-that-have-the-same-filename/m-p/182680#M80597</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2019-08-18T08:49:55Z</dc:date>
    </item>
    <item>
      <title>Re: Count the number of FlowFiles that have the same filename attribute</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Count-the-number-of-FlowFiles-that-have-the-same-filename/m-p/182681#M80598</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929"&gt;@Shu&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Thanks for your suggest solution, but it doesn't work in my set up. I might have 100 flow files coming out of duplicate relationship of DetectDuplicate processor. 50 of them will have A.txt filename while the rest will be B.txt. The expected output would be A (1).txt, ..., A (50).txt and B (1).txt, .., B(50).txt. Since the number of flow files is not a fixed number, I can't really reset the state value. They all have the same ${segment.original.filename} value by the way. If there are another 10 flow files with A.txt coming out of DetectDuplicate processor with a different ${segment.original.filename} value, then these flow file should be named from 1 to 20.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jul 2018 02:25:12 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Count-the-number-of-FlowFiles-that-have-the-same-filename/m-p/182681#M80598</guid>
      <dc:creator>hoavuong1991</dc:creator>
      <dc:date>2018-07-13T02:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: Count the number of FlowFiles that have the same filename attribute</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Count-the-number-of-FlowFiles-that-have-the-same-filename/m-p/182682#M80599</link>
      <description>&lt;P&gt;I just figured out the solution by using wait/notify processors pair. Each Notify processor will allow only one flowfile with duplicated filename. The UpdateAttribute will update a count variable in order for the Notify processor to send back to Wait processor.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="80489-untitled.png" style="width: 1209px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/19123i1093A61FCC085DB2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="80489-untitled.png" alt="80489-untitled.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 08:49:47 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Count-the-number-of-FlowFiles-that-have-the-same-filename/m-p/182682#M80599</guid>
      <dc:creator>hoavuong1991</dc:creator>
      <dc:date>2019-08-18T08:49:47Z</dc:date>
    </item>
  </channel>
</rss>

