<?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: Nifi Padding string ? in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Padding-string/m-p/215283#M60214</link>
    <description>&lt;P&gt;Is there an standard padding function in NIFI to pad a string , as in leftpad or rightpad functions provided with other languages.   I see toRadix come close to Leftpad for numbers resulting in the number getting padded with zeroes   to the left. &lt;/P&gt;</description>
    <pubDate>Sat, 29 Apr 2017 04:02:40 GMT</pubDate>
    <dc:creator>chandrashekaran</dc:creator>
    <dc:date>2017-04-29T04:02:40Z</dc:date>
    <item>
      <title>Nifi Padding string ?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Padding-string/m-p/215282#M60213</link>
      <description>&lt;P&gt;Is there a function or an expression in NIFI to left pad character strings &lt;/P&gt;</description>
      <pubDate>Sat, 29 Apr 2017 03:58:23 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Padding-string/m-p/215282#M60213</guid>
      <dc:creator>chandrashekaran</dc:creator>
      <dc:date>2017-04-29T03:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi Padding string ?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Padding-string/m-p/215283#M60214</link>
      <description>&lt;P&gt;Is there an standard padding function in NIFI to pad a string , as in leftpad or rightpad functions provided with other languages.   I see toRadix come close to Leftpad for numbers resulting in the number getting padded with zeroes   to the left. &lt;/P&gt;</description>
      <pubDate>Sat, 29 Apr 2017 04:02:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Padding-string/m-p/215283#M60214</guid>
      <dc:creator>chandrashekaran</dc:creator>
      <dc:date>2017-04-29T04:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi Padding string ?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Padding-string/m-p/215284#M60215</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/16442/chandrashekaran-kannan.html" nodeid="16442" target="_blank"&gt;@kannan chandrashekaran&lt;/A&gt;
&lt;/P&gt;&lt;P&gt;You are correct that a function does not exist at this time for padding left or right of a string.&lt;/P&gt;&lt;P&gt;That being said, You can easily accomplish string padding using a simple flow consisting of a RouteOnAttribute" and "UpdateAttribute" processor.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="14968-screen-shot-2017-05-01-at-115229-am.png" style="width: 1079px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/16320iE9EE401D9DBBB392/image-size/medium?v=v2&amp;amp;px=400" role="button" title="14968-screen-shot-2017-05-01-at-115229-am.png" alt="14968-screen-shot-2017-05-01-at-115229-am.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The RouteOnAttribute would contain one routing rule that checks the length of an attributes value and if it is not long enough routes it to the update attribute where you add one character of padding.&lt;/P&gt;&lt;P&gt;My rule looks like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="14969-screen-shot-2017-05-01-at-115534-am.png" style="width: 583px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/16321i1F9721BD652672A8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="14969-screen-shot-2017-05-01-at-115534-am.png" alt="14969-screen-shot-2017-05-01-at-115534-am.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; -- "10" is the length I want my attribute to be.&lt;/P&gt;&lt;P&gt;-- "test" is the attribute that I am calculating the length of.&lt;/P&gt;&lt;P&gt;My UpdateAttribute processor then simply pads the value assigned to"test" with a single character. &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="14970-screen-shot-2017-05-01-at-115826-am.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/16322i4DF79A39231A693C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="14970-screen-shot-2017-05-01-at-115826-am.png" alt="14970-screen-shot-2017-05-01-at-115826-am.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;FlowFiles will continue in this loop until the value of "test" has reached 10 charatcters in length.&lt;/P&gt;&lt;P&gt;Any FlowFile where the value associated to "test" has a length longer then 10 is just passed on without any change.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 03:19:07 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Padding-string/m-p/215284#M60215</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2019-08-18T03:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: Nifi Padding string ?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Padding-string/m-p/344857#M60216</link>
      <description>&lt;P&gt;Anyone coming to look at this now (Jun 2022) - You can simply use UpdateAttribute with ${test:padLeft(10, '0')} to pad a string with zeroes.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 19:22:37 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Nifi-Padding-string/m-p/344857#M60216</guid>
      <dc:creator>benjbenj</dc:creator>
      <dc:date>2022-06-01T19:22:37Z</dc:date>
    </item>
  </channel>
</rss>

