<?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: Modification of Attribute in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Modification-of-Attribute/m-p/322250#M228731</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for providing the solutions .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 09 Aug 2021 14:15:17 GMT</pubDate>
    <dc:creator>midee</dc:creator>
    <dc:date>2021-08-09T14:15:17Z</dc:date>
    <item>
      <title>Modification of Attribute</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Modification-of-Attribute/m-p/321965#M228624</link>
      <description>&lt;P&gt;I have to extract the first character from each string provided in the Flowfile attribute.&lt;/P&gt;&lt;P&gt;Suppose I have one attribute as:&lt;/P&gt;&lt;P&gt;KeyValue : Nifi Test Project&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Expected output&lt;/STRONG&gt; :&amp;nbsp;&lt;/P&gt;&lt;P&gt;Key1: NTP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please let me know how to get this and which processor to be used.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 07:01:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Modification-of-Attribute/m-p/321965#M228624</guid>
      <dc:creator>midee</dc:creator>
      <dc:date>2021-08-03T07:01:00Z</dc:date>
    </item>
    <item>
      <title>Re: Modification of Attribute</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Modification-of-Attribute/m-p/322097#M228671</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;Assuming you know how many space delimited strings you have, you could use the following NiFi Expression Language (NEL) statement to extract the first character from each string:&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;${attr1:substring(0,1)}${attr1:getDelimitedField(2,' '):substring(0,1)}${attr1:getDelimitedField(3,' '):substring(0,1)}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Above would take your example "&lt;SPAN&gt;Nifi Test Project" and produce "NTP".&lt;BR /&gt;&lt;BR /&gt;If this was not a static number of strings, you would need to count the number of strings and then use the Advanced UI of the updateAttribute processor to execute the appropriate NEL statement depending on calculated number of strings in your source attribute&lt;BR /&gt;&lt;BR /&gt;Here is an example UpdateAttribute processor configuration to accomplish this. Select "&lt;STRONG&gt;Configure&lt;/STRONG&gt;" on the UpdateAttribute processor:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MattWho_1-1628184459086.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/32014i4A78B35169E5FF69/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MattWho_1-1628184459086.png" alt="MattWho_1-1628184459086.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In the lower left you will see button to enter the "&lt;STRONG&gt;ADVANCED&lt;/STRONG&gt;" UI.&lt;BR /&gt;Within that UI you will create a new &lt;STRONG&gt;RULE&lt;/STRONG&gt; for each&amp;nbsp; string count:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MattWho_2-1628184574073.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/32015i266A74BD4778BB1A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MattWho_2-1628184574073.png" alt="MattWho_2-1628184574073.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You then create a "&lt;STRONG&gt;Conditions&lt;/STRONG&gt;" which must resolve to "&lt;STRONG&gt;TRUE&lt;/STRONG&gt;" before the "&lt;STRONG&gt;Actions&lt;/STRONG&gt;" are applied.&lt;BR /&gt;above image handles when the subject attribute value contains a single string. Below is example of more complicated Action when string count is equal to 4.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MattWho_3-1628184786119.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/32016i9A4649F83F29312C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MattWho_3-1628184786119.png" alt="MattWho_3-1628184786119.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Adding more rules is as simple as copying the last rule and editing the Condition to increment equals value and add and additional "&lt;EM&gt;&lt;STRONG&gt;${attr1:getDelimitedField(5,' '):substring(0,1)}&lt;/STRONG&gt;&lt;/EM&gt;" to the end with the next incremented field count.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;If you found this addressed your query, please take a moment to login and click "&lt;A href="https://community.cloudera.com/t5/forums/v4/forumtopicpage.markmessageasacceptedsolutionsecondarybutton/message-uid/322097?t:ac=board-id/Questions/message-id/228671&amp;amp;t:cp=solutions/contributions/acceptedsolutionsactions" target="_self"&gt;&lt;STRONG&gt;Accept as Solution&lt;/STRONG&gt;&lt;/A&gt;".&lt;BR /&gt;Thank you,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Matt&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 17:39:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Modification-of-Attribute/m-p/322097#M228671</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2021-08-05T17:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: Modification of Attribute</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Modification-of-Attribute/m-p/322166#M228697</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thanks for your reply.&amp;nbsp;&lt;BR /&gt;However, when I put the expression mentioned in your reply under condition block. It throws error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please provide the expression mentioned under&amp;nbsp;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;STRONG&gt;Conditions&lt;/STRONG&gt;&lt;SPAN&gt;"&amp;nbsp;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Aug 2021 14:00:19 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Modification-of-Attribute/m-p/322166#M228697</guid>
      <dc:creator>midee</dc:creator>
      <dc:date>2021-08-06T14:00:19Z</dc:date>
    </item>
    <item>
      <title>Re: Modification of Attribute</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Modification-of-Attribute/m-p/322241#M228730</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;The condition NEL statement and resulting actions NEL statements will be unique for each rule you create.&lt;BR /&gt;&lt;BR /&gt;For example:&lt;BR /&gt;&lt;STRONG&gt;Rule 1:&lt;/STRONG&gt;&lt;BR /&gt;Conditions:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;${attr1:trim():length():minus(${attr1:trim():replaceAll(' ',''):length()}):plus(1):equals(1)}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;${attr1:substring(0,1)}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Rule2:&lt;BR /&gt;&lt;/STRONG&gt;Conditions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;${attr1:trim():length():minus(${attr1:trim():replaceAll(' ',''):length()}):plus(1):equals(2)}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;${attr1:substring(0,1)}${attr1:getDelimitedField(2,' '):substring(0,1)}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Rule3:&lt;/STRONG&gt;&lt;BR /&gt;Conditions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;${attr1:trim():length():minus(${attr1:trim():replaceAll(' ',''):length()}):plus(1):equals(3)}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;${attr1:substring(0,1)}${attr1:getDelimitedField(2,' '):substring(0,1)}${attr1:getDelimitedField(3,' '):substring(0,1)}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Rule4:&lt;/STRONG&gt;&lt;BR /&gt;Conditions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;${attr1:trim():length():minus(${attr1:trim():replaceAll(' ',''):length()}):plus(1):equals(4)}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;${attr1:substring(0,1)}${attr1:getDelimitedField(2,' '):substring(0,1)}${attr1:getDelimitedField(3,' '):substring(0,1)}${attr1:getDelimitedField(4,' '):substring(0,1)}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;You will notice in the Conditions NEL statement, the last number is incrementing for each rule and in the Actions NEL statement the statement gets a bit longer with each additional string&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;If you found these answers to your query were useful, please take a moment to login and click "Accept as Solution" on all answers that helped.&lt;BR /&gt;Hope this helps,&lt;BR /&gt;Matt&lt;/P&gt;</description>
      <pubDate>Mon, 09 Aug 2021 12:38:46 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Modification-of-Attribute/m-p/322241#M228730</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2021-08-09T12:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: Modification of Attribute</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Modification-of-Attribute/m-p/322250#M228731</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for providing the solutions .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 09 Aug 2021 14:15:17 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Modification-of-Attribute/m-p/322250#M228731</guid>
      <dc:creator>midee</dc:creator>
      <dc:date>2021-08-09T14:15:17Z</dc:date>
    </item>
  </channel>
</rss>

