<?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: ReplaceText: write content on empty flowfile does nothing but sends to success queue in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/ReplaceText-write-content-on-empty-flowfile-does-nothing-but/m-p/370109#M240630</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt; , thanks for your response. You are right, changing to "Entire Text" worked&lt;BR /&gt;I was in a hurry and didnt try changing the evaluation mode. I supposed that "Always Replace" would do the work.&lt;BR /&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Thu, 04 May 2023 17:56:49 GMT</pubDate>
    <dc:creator>martinpla</dc:creator>
    <dc:date>2023-05-04T17:56:49Z</dc:date>
    <item>
      <title>ReplaceText: write content on empty flowfile does nothing but sends to success queue</title>
      <link>https://community.cloudera.com/t5/Support-Questions/ReplaceText-write-content-on-empty-flowfile-does-nothing-but/m-p/370096#M240624</link>
      <description>&lt;P&gt;Hello. Well, I have a nifi flow that is triggered by a ListFile processor. ListFile creates an empty content flowfile and sends it to success queue.&lt;BR /&gt;I want to write some fixed content ( say "id,description,date" ) on this empty flowfile. The goal is to write an empty csv with that header in HDFS&amp;nbsp; as first action of the flow.&lt;BR /&gt;So I was trying to use ReplaceText for writing the content to the empty flowfile.&lt;BR /&gt;The flow looks like this&amp;nbsp; &amp;nbsp; ListFile ---&amp;gt; ReplaceText (see image below)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image1.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/37500i6CA4F7593817A277/image-size/medium?v=v2&amp;amp;px=400" role="button" title="image1.png" alt="image1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;ReplaceText has the following settings: Replacement Strategy = Always Replace, Replacement Value = id,description,date&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;At first I thougt that ReplaceText could fail cause incoming flowfile had no content.&lt;BR /&gt;But ReplaceText sent the flowfile to success BUT NO CONTENT WAS WRITTEN (It is still empty)&lt;BR /&gt;In the image below you can see that Queued Bytes are 0&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image2.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/37499i16A5368DA1C19829/image-size/medium?v=v2&amp;amp;px=400" role="button" title="image2.png" alt="image2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Setting Bulletin Level to "DEBUG" just throws the following message : "&lt;EM&gt;ReplaceText[id=501319d3-354d-1482-6c84-d176639be85f] Transferred FlowFile[filename=Control de trabajos de pala - Control punto a punto.csv] to 'success'&lt;/EM&gt;"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is Replacetext supposed to write content on an empty file ?&lt;BR /&gt;If not then empty flowfile should be sent to failure queue, right ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: for reproducing the bug (I guess we can call it a bug), you can use GenerateFlowfile instead of ListFile and you will get the same result.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks for any feed back. I guess i will have to use a ExecuteScript processor which is a bit more dificult.&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2023 16:57:10 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/ReplaceText-write-content-on-empty-flowfile-does-nothing-but/m-p/370096#M240624</guid>
      <dc:creator>martinpla</dc:creator>
      <dc:date>2023-05-04T16:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: ReplaceText: write content on empty flowfile does nothing but sends to success queue</title>
      <link>https://community.cloudera.com/t5/Support-Questions/ReplaceText-write-content-on-empty-flowfile-does-nothing-but/m-p/370098#M240626</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/104122"&gt;@martinpla&lt;/a&gt;&amp;nbsp;Welcome to the Cloudera Community!&lt;BR /&gt;&lt;BR /&gt;To help you get the best possible solution, I have tagged our NiFi experts&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/103151"&gt;@cotopaul&lt;/a&gt;&amp;nbsp;&amp;nbsp;who may be able to assist you further&lt;BR /&gt;&lt;BR /&gt;Please keep us updated on your post, and we hope you find a satisfactory solution to your query.&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2023 16:59:44 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/ReplaceText-write-content-on-empty-flowfile-does-nothing-but/m-p/370098#M240626</guid>
      <dc:creator>DianaTorres</dc:creator>
      <dc:date>2023-05-04T16:59:44Z</dc:date>
    </item>
    <item>
      <title>Re: ReplaceText: write content on empty flowfile does nothing but sends to success queue</title>
      <link>https://community.cloudera.com/t5/Support-Questions/ReplaceText-write-content-on-empty-flowfile-does-nothing-but/m-p/370106#M240629</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I dont think there is a bug here. It all depends on the value you set in ReplaceText for the &lt;STRONG&gt;Evaluation Mode&lt;/STRONG&gt; property. My guess is that you have set to the default value which is "Line-by-Line" which makes sense in this case because you have no lines. To make this work you need to set it to "&lt;STRONG&gt;Entire Text&lt;/STRONG&gt;" instead as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SAMSAL_0-1683222229230.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/37503i0DB165508AA4FF7A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SAMSAL_0-1683222229230.png" alt="SAMSAL_0-1683222229230.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to check if the file&amp;nbsp; coming from the ListFile to see if it has content or not and then&amp;nbsp; route accordingly , you can use RouteOnAttribute to check against the built-in flow file attribute "fileSize" using expression language: &lt;STRONG&gt;${fileSize:equals(0)}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If that helps please &lt;STRONG&gt;accept&lt;/STRONG&gt; solution.&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>Thu, 04 May 2023 17:48:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/ReplaceText-write-content-on-empty-flowfile-does-nothing-but/m-p/370106#M240629</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2023-05-04T17:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: ReplaceText: write content on empty flowfile does nothing but sends to success queue</title>
      <link>https://community.cloudera.com/t5/Support-Questions/ReplaceText-write-content-on-empty-flowfile-does-nothing-but/m-p/370109#M240630</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt; , thanks for your response. You are right, changing to "Entire Text" worked&lt;BR /&gt;I was in a hurry and didnt try changing the evaluation mode. I supposed that "Always Replace" would do the work.&lt;BR /&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2023 17:56:49 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/ReplaceText-write-content-on-empty-flowfile-does-nothing-but/m-p/370109#M240630</guid>
      <dc:creator>martinpla</dc:creator>
      <dc:date>2023-05-04T17:56:49Z</dc:date>
    </item>
  </channel>
</rss>

