<?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: default value if an attribute of a flowfile is null in nifi in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/default-value-if-an-attribute-of-a-flowfile-is-null-in-nifi/m-p/148014#M52639</link>
    <description>&lt;P&gt;Thanks for your guidelines @&lt;A href="https://community.hortonworks.com/users/525/mclark.html"&gt;Matt&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.hortonworks.com/users/525/mclark.html"&gt;&lt;/A&gt;I am sure each flow file is having grade and branch attributes . as you said ,  We are getting NULL(no value set) values not empty for branch and grade&lt;/P&gt;&lt;P&gt;in my case ,We have 3 conditions in which data will be :&lt;/P&gt;&lt;P&gt; 1. sometimes we are getting NULL value for grade , not for branch . &lt;/P&gt;&lt;P&gt;2.sometimes , NULL for branch ,some value for grade . &lt;/P&gt;&lt;P&gt;3. sometimes both fields are getting NULL values .&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ex : ename, eno , salary , branch ,grade&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;srini,1,10000,branch-A,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sai,2,2000,,grade-A&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sai,3,,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;
&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;As i understood , conditions are wokr with 'AND' caluse , will above solution work for my case ? &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Thanks in Advance . &lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 27 Jan 2017 01:17:51 GMT</pubDate>
    <dc:creator>srinivaspadala_</dc:creator>
    <dc:date>2017-01-27T01:17:51Z</dc:date>
    <item>
      <title>default value if an attribute of a flowfile is null in nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/default-value-if-an-attribute-of-a-flowfile-is-null-in-nifi/m-p/148010#M52635</link>
      <description>&lt;P&gt;IS there any way to assign a default value if an attribute of a flowfile is NULL or empty in Nifi flow . &lt;/P&gt;&lt;P&gt;ex: We are getting realtime streaming data (ename, empNO , salary , grade,branch) , now and then We are getting null values for the grade and branch  fields . We would like to assign 'nograde','branch-none' values to grade,branch attributes in Nifi processor . Please let us know the way . Thanks in advance . &lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2017 11:58:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/default-value-if-an-attribute-of-a-flowfile-is-null-in-nifi/m-p/148010#M52635</guid>
      <dc:creator>srinivaspadala_</dc:creator>
      <dc:date>2017-01-26T11:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: default value if an attribute of a flowfile is null in nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/default-value-if-an-attribute-of-a-flowfile-is-null-in-nifi/m-p/148011#M52636</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="11787-screen-shot-2017-01-25-at-114427-pm.png" style="width: 1554px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/21347i05375F59733B9F7E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="11787-screen-shot-2017-01-25-at-114427-pm.png" alt="11787-screen-shot-2017-01-25-at-114427-pm.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;you can use the updateAttribute processor. for the grade attribute, use the EL ${grade:replaceNull("nograde")}.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 13:15:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/default-value-if-an-attribute-of-a-flowfile-is-null-in-nifi/m-p/148011#M52636</guid>
      <dc:creator>knarayanan</dc:creator>
      <dc:date>2019-08-18T13:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: default value if an attribute of a flowfile is null in nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/default-value-if-an-attribute-of-a-flowfile-is-null-in-nifi/m-p/148012#M52637</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/13387/srinivaspadalacs.html" nodeid="13387" target="_blank"&gt;@srini&lt;/A&gt;
&lt;/P&gt;&lt;P&gt;NULL and empty are two different things and need to handled in two different ways.&lt;/P&gt;&lt;P&gt;NULL indicates there is no value set, while EMPTY means a value of type new line, carriage return, tab, or space has been set as the value.  &lt;/P&gt;&lt;P&gt;There are a number of NiFi Expression language functions that work with non-exist attributes and attributes with either null or empty values.&lt;/P&gt;&lt;P&gt;First question to ask is whether every FlowFile has both the branch and grade attributes?  If some are missing the attributes, different handling needs to be done.  If you don't know for sure that every FlowFile will have these attributes created, I suggest using the "isEmpty" NiFi expression language function to check.  The "isEmpty" function will return true if the attributes does not exist, exist containing no value or exist containing only new line, carriage return, tab, or space.&lt;/P&gt;&lt;P&gt;
The UpdateAttribute has an "Advanced" UI that allows you to create if/then type functions.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="11801-screen-shot-2017-01-26-at-91119-am.png" style="width: 938px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/21346iC84F2B4EBD4346C1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="11801-screen-shot-2017-01-26-at-91119-am.png" alt="11801-screen-shot-2017-01-26-at-91119-am.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So With the above rules applied, all FlowFile leaving this UpdateAttribute processor will have both the "branch" and "grade" attributes.  Those attributes will either have some previously assigned non-empty value or the "nobranch" and/or "nograde" values assigned to them.  This works even if the incoming FlowFile was missing these attributes.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 13:15:42 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/default-value-if-an-attribute-of-a-flowfile-is-null-in-nifi/m-p/148012#M52637</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2019-08-18T13:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: default value if an attribute of a flowfile is null in nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/default-value-if-an-attribute-of-a-flowfile-is-null-in-nifi/m-p/148013#M52638</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/10180/knarayanan.html" nodeid="10180"&gt;@Karthik Narayanan&lt;/A&gt; &lt;/P&gt;&lt;P&gt;The only problem with the "replaceNull" function is that it will only return either "nograde" or "nobranch" if the incoming FlowFile does not have have an attribute with the name "grade" or " branch".    If they exist but have no value set, the result will still be set to no value instead of being assigned "nograde" or "nobranch".&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2017 22:27:05 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/default-value-if-an-attribute-of-a-flowfile-is-null-in-nifi/m-p/148013#M52638</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2017-01-26T22:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: default value if an attribute of a flowfile is null in nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/default-value-if-an-attribute-of-a-flowfile-is-null-in-nifi/m-p/148014#M52639</link>
      <description>&lt;P&gt;Thanks for your guidelines @&lt;A href="https://community.hortonworks.com/users/525/mclark.html"&gt;Matt&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.hortonworks.com/users/525/mclark.html"&gt;&lt;/A&gt;I am sure each flow file is having grade and branch attributes . as you said ,  We are getting NULL(no value set) values not empty for branch and grade&lt;/P&gt;&lt;P&gt;in my case ,We have 3 conditions in which data will be :&lt;/P&gt;&lt;P&gt; 1. sometimes we are getting NULL value for grade , not for branch . &lt;/P&gt;&lt;P&gt;2.sometimes , NULL for branch ,some value for grade . &lt;/P&gt;&lt;P&gt;3. sometimes both fields are getting NULL values .&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ex : ename, eno , salary , branch ,grade&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;srini,1,10000,branch-A,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sai,2,2000,,grade-A&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sai,3,,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;
&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;As i understood , conditions are wokr with 'AND' caluse , will above solution work for my case ? &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Thanks in Advance . &lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2017 01:17:51 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/default-value-if-an-attribute-of-a-flowfile-is-null-in-nifi/m-p/148014#M52639</guid>
      <dc:creator>srinivaspadala_</dc:creator>
      <dc:date>2017-01-27T01:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: default value if an attribute of a flowfile is null in nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/default-value-if-an-attribute-of-a-flowfile-is-null-in-nifi/m-p/148015#M52640</link>
      <description>&lt;P&gt;yeah , agree with that.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2017 01:18:23 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/default-value-if-an-attribute-of-a-flowfile-is-null-in-nifi/m-p/148015#M52640</guid>
      <dc:creator>knarayanan</dc:creator>
      <dc:date>2017-01-27T01:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: default value if an attribute of a flowfile is null in nifi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/default-value-if-an-attribute-of-a-flowfile-is-null-in-nifi/m-p/148016#M52641</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/13387/srinivaspadalacs.html" nodeid="13387"&gt;@srini&lt;/A&gt;
&lt;/P&gt;&lt;P&gt;The default "FlowFIle Policy" is "use clone" within the advanced UI.  For an "and" operation, you will want change that to "use original".  Just keep in mind (does not apply here since both rules are unique) that if more then one rule tries to perform the exact same "Actions", only the last rule in the list that will be applied to the original FlowFile on output.&lt;/P&gt;&lt;P&gt;Both "Rules" are run against every FlowFile that passes through this UpdateAttribute processor, so it will work in cases where only one or the other is set and cases where both are not set. Rules are operated on in the order they are listed.  You can drag rules up and down in the list to order them how you like.&lt;/P&gt;&lt;P&gt;If this answer addresses your question, please click "accept".&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jan 2017 01:36:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/default-value-if-an-attribute-of-a-flowfile-is-null-in-nifi/m-p/148016#M52641</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2017-01-27T01:36:25Z</dc:date>
    </item>
  </channel>
</rss>

