<?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>topic routine to convert number to fixed length with last digit=ASCII logic in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/routine-to-convert-number-to-fixed-length-with-last-digit-ASCII/m-p/2292425#M65499</link>
    <description>&lt;P&gt;I need to write a routine to convert numbers to fixed length string, with the last digit following ASCII logic&lt;/P&gt; 
&lt;P&gt;for example:&amp;nbsp;balance &amp;nbsp;is decimal(12,2), the value is&amp;nbsp; -415158.1, requested fixed length is 12, left pad 0 if the length is less than 12, and the . should be removed.&lt;/P&gt; 
&lt;P&gt;ASCII logic is:&lt;/P&gt; 
&lt;P&gt;if the last digit is&amp;nbsp;0 and it is negative, convert the last number to&amp;nbsp;}&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;if the last digit is&amp;nbsp;1&amp;nbsp;and it is negative, convert the last number to&amp;nbsp;J,&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;if the last digit is&amp;nbsp;2&amp;nbsp;and it is negative, convert the last number to&amp;nbsp;K&amp;nbsp;...&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;if the last digit is&amp;nbsp;0 and it is positive, convert the last number to&amp;nbsp;{&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;if the last digit is&amp;nbsp;1&amp;nbsp;and it is positive, convert the last number to&amp;nbsp;A,&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;if the last digit is&amp;nbsp;2&amp;nbsp;and it is&amp;nbsp;positive, convert the last number to&amp;nbsp;B,....&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;This translate routine will have 3 variables, one decimal &lt;STRONG&gt;Balance&lt;/STRONG&gt;, one integer &lt;STRONG&gt;length1&lt;/STRONG&gt;, one integer&amp;nbsp;&lt;STRONG&gt;decimal1&lt;/STRONG&gt;&lt;/P&gt; 
&lt;P&gt;&lt;STRONG&gt;t&lt;/STRONG&gt;ranslate(-415158.1,12,2)&amp;nbsp; &amp;nbsp;returns&amp;nbsp;&lt;SPAN&gt;0000&lt;/SPAN&gt;&lt;SPAN&gt;4151581}&amp;nbsp; &amp;nbsp;(first make it to&amp;nbsp;-415158.10)&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;t&lt;/STRONG&gt;ranslate(-415158.11,12,2) returns&amp;nbsp;00004151581J&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;t&lt;/STRONG&gt;ranslate(415158,12,2)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;returns&amp;nbsp;00004151580{&amp;nbsp; &amp;nbsp;(first make it to&amp;nbsp;415158.00)&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;I have very limited knowledge in java, please help. Thank you.&lt;/P&gt;</description>
    <pubDate>Fri, 03 Aug 2018 22:31:18 GMT</pubDate>
    <dc:creator>JaneYu</dc:creator>
    <dc:date>2018-08-03T22:31:18Z</dc:date>
    <item>
      <title>routine to convert number to fixed length with last digit=ASCII logic</title>
      <link>https://community.qlik.com/t5/Talend-Studio/routine-to-convert-number-to-fixed-length-with-last-digit-ASCII/m-p/2292425#M65499</link>
      <description>&lt;P&gt;I need to write a routine to convert numbers to fixed length string, with the last digit following ASCII logic&lt;/P&gt; 
&lt;P&gt;for example:&amp;nbsp;balance &amp;nbsp;is decimal(12,2), the value is&amp;nbsp; -415158.1, requested fixed length is 12, left pad 0 if the length is less than 12, and the . should be removed.&lt;/P&gt; 
&lt;P&gt;ASCII logic is:&lt;/P&gt; 
&lt;P&gt;if the last digit is&amp;nbsp;0 and it is negative, convert the last number to&amp;nbsp;}&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;if the last digit is&amp;nbsp;1&amp;nbsp;and it is negative, convert the last number to&amp;nbsp;J,&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;if the last digit is&amp;nbsp;2&amp;nbsp;and it is negative, convert the last number to&amp;nbsp;K&amp;nbsp;...&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;if the last digit is&amp;nbsp;0 and it is positive, convert the last number to&amp;nbsp;{&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;if the last digit is&amp;nbsp;1&amp;nbsp;and it is positive, convert the last number to&amp;nbsp;A,&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;if the last digit is&amp;nbsp;2&amp;nbsp;and it is&amp;nbsp;positive, convert the last number to&amp;nbsp;B,....&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;This translate routine will have 3 variables, one decimal &lt;STRONG&gt;Balance&lt;/STRONG&gt;, one integer &lt;STRONG&gt;length1&lt;/STRONG&gt;, one integer&amp;nbsp;&lt;STRONG&gt;decimal1&lt;/STRONG&gt;&lt;/P&gt; 
&lt;P&gt;&lt;STRONG&gt;t&lt;/STRONG&gt;ranslate(-415158.1,12,2)&amp;nbsp; &amp;nbsp;returns&amp;nbsp;&lt;SPAN&gt;0000&lt;/SPAN&gt;&lt;SPAN&gt;4151581}&amp;nbsp; &amp;nbsp;(first make it to&amp;nbsp;-415158.10)&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;t&lt;/STRONG&gt;ranslate(-415158.11,12,2) returns&amp;nbsp;00004151581J&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;t&lt;/STRONG&gt;ranslate(415158,12,2)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;returns&amp;nbsp;00004151580{&amp;nbsp; &amp;nbsp;(first make it to&amp;nbsp;415158.00)&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;I have very limited knowledge in java, please help. Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Aug 2018 22:31:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/routine-to-convert-number-to-fixed-length-with-last-digit-ASCII/m-p/2292425#M65499</guid>
      <dc:creator>JaneYu</dc:creator>
      <dc:date>2018-08-03T22:31:18Z</dc:date>
    </item>
  </channel>
</rss>

