<?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: IF statement for NiFi attribute result - NiFi in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/IF-statement-for-NiFi-attribute-result-NiFi/m-p/333496#M231448</link>
    <description>&lt;P&gt;Thanks Matt!! I hadn't used the advanced tab on the processor until now, worked a treat for my use case. Apologies for the slightly confusing question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am now able to pick out key words from the hostname attribute to direct them to the correct database. Thanks for the quick response!&lt;/P&gt;</description>
    <pubDate>Mon, 10 Jan 2022 14:21:52 GMT</pubDate>
    <dc:creator>Griggsy</dc:creator>
    <dc:date>2022-01-10T14:21:52Z</dc:date>
    <item>
      <title>IF statement for NiFi attribute result - NiFi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/IF-statement-for-NiFi-attribute-result-NiFi/m-p/333464#M231441</link>
      <description>&lt;P&gt;Hello all&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Within NiFi, updateAttribute processor I am trying to change an attribute called 'hive_database' based on the value of another attribute called 'hostname'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For instance if:&lt;/P&gt;&lt;P&gt;#1: hostname = Mickey Mouse&lt;/P&gt;&lt;P&gt;#2: hostname = James Bond&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to use a 'contains' statement (or similar ) to change the output of new attribute 'hive_database'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;property:&lt;/P&gt;&lt;P&gt;hive_database&lt;/P&gt;&lt;P&gt;value:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;${hostname:contains('Mickey'):&amp;lt;OUTPUT&amp;gt;('cartoon')} &amp;lt;OR&amp;gt;&lt;BR /&gt;${hostname:contains('Mickey'):&amp;lt;OUTPUT&amp;gt;('movie')}&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So that #1 output would be: &lt;EM&gt;property=&lt;/EM&gt; hive_database &lt;EM&gt;value=&lt;/EM&gt; cartoon&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The parts I'm stuck on is the OUTPUT and OR parts above, do you know if this would be possible using the update attribute processor? I am trying to avoid having to use routeOnAttribute to break out multiple different 'hosname' values to send data to the relevant 'hive_database'&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hope this makes sense, unable to share screenshots etc as sensitive vales.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any help greatly appreciated.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2026 08:02:13 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/IF-statement-for-NiFi-attribute-result-NiFi/m-p/333464#M231441</guid>
      <dc:creator>Griggsy</dc:creator>
      <dc:date>2026-04-21T08:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: IF statement for NiFi attribute result - NiFi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/IF-statement-for-NiFi-attribute-result-NiFi/m-p/333494#M231447</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/77674"&gt;@Griggsy&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The "&lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-update-attribute-nar/1.15.2/org.apache.nifi.processors.attributes.UpdateAttribute/additionalDetails.html" target="_self"&gt;Advanced&lt;/A&gt;" UI capability in the &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-update-attribute-nar/1.15.2/org.apache.nifi.processors.attributes.UpdateAttribute/index.html" target="_self"&gt;UpdateAttribute&lt;/A&gt;&amp;nbsp;processor allows you to setup rules to accomplish exactly what you are describing here in your use case.&amp;nbsp; When you right click on the UpdateAttribute processor you will see the "Advanced" button in the lower left corner.&lt;BR /&gt;&lt;BR /&gt;From the Advanced UI you can configure conditional rules.&lt;BR /&gt;1. Click "+" to the right of "Rules" to create your first rule.&lt;BR /&gt;2. Then click "+" to right of "Conditions" to create your boolean NiFi Expression Language (NEL) statement(s).&amp;nbsp; When using multiple statements, all statements must result in true before the corresponding "Action(s)" would be applied.&lt;BR /&gt;3. Then click "+" to right of "Actions" to set create one or more actions that are applied if the condition(s) for this rule are true.&lt;BR /&gt;&lt;BR /&gt;The thing is that your example or condition does not make sense to me.&lt;BR /&gt;You are returning the value from a FlowFile attribute named "hostname" and checking if it contains the string "Mickey" in both NEL statements.&amp;nbsp; However, for each you want to return a different output value?&amp;nbsp;&lt;BR /&gt;Since both would always return either "true" or "false", which output would be desired?&lt;BR /&gt;&lt;BR /&gt;Here is example where i check if "Hostname" attribute contains "Mickey" and if that returns true I set FlowFile attribute "hive_database" to "cartoon".&amp;nbsp; I then have a second rule that checks the "Hostname" FlowFile attribute to see if it contains "Bond" and iid that returns true, I set "hive_database" FlowFile" attribute to "movie".&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MattWho_0-1641822662960.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/33113iC0D96C4A601B43A2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MattWho_0-1641822662960.png" alt="MattWho_0-1641822662960.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The "conditions" and "actions" look similar for the "Bond" rule except "Mickey" is changed to "Bond" and cartoon is set to "movie" instead of "cartoon".&lt;BR /&gt;&lt;BR /&gt;So above rules give you an If/then capability. Another feature of using the advanced UI is the "else" capability.&amp;nbsp; Outside the "Advanced" UI set a attribute for "hive_database":&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MattWho_1-1641823020085.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/33114i0C12E8B0B902A726/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MattWho_1-1641823020085.png" alt="MattWho_1-1641823020085.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;If I were to define actions that set the "hive_database" FlowFile attribute and upon evaluating a FlowFile none of the configured rules that set the "hive_database" attribute are applied, the update Attribute processor will set apply the value set outside the advanced UI.&amp;nbsp; If a rule sets the the attribute "hive_database", then value defined outside advanced UI is ignored/not set.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If you found this response assisted with your query, please take a moment to login and click on "&lt;STRONG&gt;Accept as Solution&lt;/STRONG&gt;" below this post.&lt;BR /&gt;&lt;BR /&gt;Thank you,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 13:58:55 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/IF-statement-for-NiFi-attribute-result-NiFi/m-p/333494#M231447</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2022-01-10T13:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: IF statement for NiFi attribute result - NiFi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/IF-statement-for-NiFi-attribute-result-NiFi/m-p/333496#M231448</link>
      <description>&lt;P&gt;Thanks Matt!! I hadn't used the advanced tab on the processor until now, worked a treat for my use case. Apologies for the slightly confusing question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am now able to pick out key words from the hostname attribute to direct them to the correct database. Thanks for the quick response!&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 14:21:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/IF-statement-for-NiFi-attribute-result-NiFi/m-p/333496#M231448</guid>
      <dc:creator>Griggsy</dc:creator>
      <dc:date>2022-01-10T14:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: IF statement for NiFi attribute result - NiFi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/IF-statement-for-NiFi-attribute-result-NiFi/m-p/354100#M236845</link>
      <description>&lt;P&gt;Hi, for me this is not working. My desired attribute remains unchanged after it undergoes the UpdateAttribute processor. What could be the cause of this? I have a property called "api" with the default value "web page". My rule is ${url:contains('webpage')}&lt;/P&gt;&lt;P data-unlink="true"&gt;and the action "api" and "web page". The "url" property contains the address as in "https://www.webpage.com/site".&lt;/P&gt;&lt;P data-unlink="true"&gt;Any ideas what I should check?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 15:15:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/IF-statement-for-NiFi-attribute-result-NiFi/m-p/354100#M236845</guid>
      <dc:creator>Fredi</dc:creator>
      <dc:date>2022-10-05T15:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: IF statement for NiFi attribute result - NiFi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/IF-statement-for-NiFi-attribute-result-NiFi/m-p/354874#M237003</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/100919"&gt;@Fredi&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you send a screenshot of the advanced tab rules if possible, I'm a little confused as to what you are wanting to achieve.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2022 09:58:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/IF-statement-for-NiFi-attribute-result-NiFi/m-p/354874#M237003</guid>
      <dc:creator>Griggsy</dc:creator>
      <dc:date>2022-10-14T09:58:33Z</dc:date>
    </item>
    <item>
      <title>Re: IF statement for NiFi attribute result - NiFi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/IF-statement-for-NiFi-attribute-result-NiFi/m-p/355853#M237150</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/100919"&gt;@Fredi&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;A screenshot of the configuration of your UpdateAttribute processor including main configuration and configuration in the "Advanced" UI would be very helpful in understanding your setup and issue.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Fri, 21 Oct 2022 19:28:57 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/IF-statement-for-NiFi-attribute-result-NiFi/m-p/355853#M237150</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2022-10-21T19:28:57Z</dc:date>
    </item>
  </channel>
</rss>

