<?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 Re: String to Float conversion in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359204#M124073</link>
    <description>Hi umeshrakhe, 
&lt;BR /&gt;I'm sorry if my prob keeps bugging you. I'm however still receiving error. 
&lt;BR /&gt;My code follows exactly as you are: 
&lt;BR /&gt; 
&lt;PRE&gt;package routines;&lt;BR /&gt;public class NumericConversion {&lt;BR /&gt;    public static BigDecimal GetDecimalFromFixedString(String Column,int Precision)&lt;BR /&gt;    {&lt;BR /&gt;    BigDecimal Result= new BigDecimal("0.00");&lt;BR /&gt;    String s = Column.substring(0,((Column).length()- Precision));&lt;BR /&gt;                    &lt;BR /&gt;                  String ss =Column.replace(s, "");&lt;BR /&gt;                  Result =new BigDecimal(s+"."+ss);&lt;BR /&gt;    return Result =new BigDecimal(s+"."+ss);&lt;BR /&gt;    }&lt;BR /&gt;}&lt;/PRE&gt; 
&lt;BR /&gt;Attached are the image files of the errors I received. 
&lt;BR /&gt;Regards, 
&lt;BR /&gt;Rozie 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MDwi.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/146655i069D87B5321B3685/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MDwi.jpg" alt="0683p000009MDwi.jpg" /&gt;&lt;/span&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MDro.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/130472iDB5C5CA134676E75/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MDro.jpg" alt="0683p000009MDro.jpg" /&gt;&lt;/span&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MDwn.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/128192i26B698C4F911563D/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MDwn.jpg" alt="0683p000009MDwn.jpg" /&gt;&lt;/span&gt;</description>
    <pubDate>Thu, 21 Mar 2013 02:29:41 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2013-03-21T02:29:41Z</dc:date>
    <item>
      <title>String to Float conversion</title>
      <link>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359193#M124062</link>
      <description>Hi Talend community,&lt;BR /&gt;I have a problem with converting from String to Float. &lt;BR /&gt;This is my input:&lt;BR /&gt;3	11	29	0	01020	50	8101	0100	0000	0	000&lt;BR /&gt;0	00	00	0	00000	00	0000	0000	0000	0	000&lt;BR /&gt;0	00	00	0	00000	00	0000	0000	0000	0	000&lt;BR /&gt;Expected output:&lt;BR /&gt;3	11	29	0	01020	50	81.01	01.00	00.00	0	000&lt;BR /&gt;0	00	00	0	00000	00	00.00	00.00	00.00	0	000&lt;BR /&gt;0	00	00	0	00000	00	00.00	00.00	00.00	0	000&lt;BR /&gt;&lt;BR /&gt;I've tried with Float parse and put precision of 2 at tMap. But the output only display 0. Does this has something to do with 0 value.&lt;BR /&gt;Thanks in advance!</description>
      <pubDate>Mon, 25 Feb 2013 04:14:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359193#M124062</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-02-25T04:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: String to Float conversion</title>
      <link>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359194#M124063</link>
      <description>I would try to use BigDecimal instead of float and set the precision to 2</description>
      <pubDate>Mon, 25 Feb 2013 17:28:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359194#M124063</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-02-25T17:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: String to Float conversion</title>
      <link>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359195#M124064</link>
      <description>Hi lubod, 
&lt;BR /&gt;I've tested with BigDecimal but same result 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MPcz.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/157233iD1A564EF62DE3BC2/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MPcz.png" alt="0683p000009MPcz.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;Please help me how. 
&lt;BR /&gt;Current output: 
&lt;BR /&gt;------------------- 
&lt;BR /&gt;3 11 29 0 01020 50 8101 100 0 0 000 
&lt;BR /&gt;0 00 00 0 00000 00 0000 0 0 0 000 
&lt;BR /&gt;0 00 00 0 00000 00 0000 0 0 0 000 
&lt;BR /&gt;Many thanks in advance.</description>
      <pubDate>Tue, 26 Feb 2013 01:49:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359195#M124064</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-02-26T01:49:13Z</dc:date>
    </item>
    <item>
      <title>Re: String to Float conversion</title>
      <link>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359196#M124065</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Hi Talend community,&lt;BR /&gt;I have a problem with converting from String to Float. &lt;BR /&gt;This is my input:&lt;BR /&gt;3	11	29	0	01020	50	8101	0100	0000	0	000&lt;BR /&gt;0	00	00	0	00000	00	0000	0000	0000	0	000&lt;BR /&gt;0	00	00	0	00000	00	0000	0000	0000	0	000&lt;BR /&gt;Expected output:&lt;BR /&gt;3	11	29	0	01020	50	81.01	01.00	00.00	0	000&lt;BR /&gt;0	00	00	0	00000	00	00.00	00.00	00.00	0	000&lt;BR /&gt;0	00	00	0	00000	00	00.00	00.00	00.00	0	000&lt;BR /&gt;&lt;BR /&gt;I've tried with Float parse and put precision of 2 at tMap. But the output only display 0. Does this has something to do with 0 value.&lt;BR /&gt;Thanks in advance!&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;Hi Rozie,&lt;BR /&gt;You can do this even without using tMap by changing the schema of the input file column to BigDecimal with  precision 2. If you want to do this using tMap then you need to change both the input and the output schema columns of tMap to BigDecimal with precision 2. &lt;BR /&gt;Best Regards,&lt;BR /&gt;Diwakar</description>
      <pubDate>Tue, 26 Feb 2013 07:14:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359196#M124065</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-02-26T07:14:51Z</dc:date>
    </item>
    <item>
      <title>Re: String to Float conversion</title>
      <link>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359197#M124066</link>
      <description>Create a function like below&lt;BR /&gt;&lt;PRE&gt;GetDecimalFromFixedString(String Column,int Precision)&lt;BR /&gt;{&lt;BR /&gt;BigDecimal Result= new BigDecimal("0.00");&lt;BR /&gt;String s = Column.substring(0,((Column).length()- Precision));&lt;BR /&gt;		    	&lt;BR /&gt;		    	 String ss =Column.replace(s, "");&lt;BR /&gt;	 		 Result =new BigDecimal(s+"."+ss);&lt;BR /&gt;return Result =new BigDecimal(s+"."+ss);&lt;BR /&gt;}&lt;/PRE&gt;&lt;BR /&gt;Handel exceptions and errors which may come if your input string null or empty.</description>
      <pubDate>Tue, 26 Feb 2013 08:47:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359197#M124066</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-02-26T08:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: String to Float conversion</title>
      <link>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359198#M124067</link>
      <description>Hi umeshrakhe,&lt;BR /&gt;I'm sorry but where should I put the function code at? Create new routine or tJava?&lt;BR /&gt;Could you please show me steps of doing so?&lt;BR /&gt;Thanks in advance!</description>
      <pubDate>Mon, 04 Mar 2013 03:49:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359198#M124067</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-03-04T03:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: String to Float conversion</title>
      <link>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359199#M124068</link>
      <description>create a new routine and place above function, and then call this function using tMap or Tjavarow where you want to convert the values. best way is use tMap. &lt;BR /&gt;&lt;PRE&gt;public static BigDecimal GetDecimalFromFixedString(String Column,int Precision)&lt;BR /&gt;{&lt;BR /&gt;BigDecimal Result= new BigDecimal("0.00");&lt;BR /&gt;String s = Column.substring(0,((Column).length()- Precision));&lt;BR /&gt;                &lt;BR /&gt;                 String ss =Column.replace(s, "");&lt;BR /&gt;              Result =new BigDecimal(s+"."+ss);&lt;BR /&gt;return Result =new BigDecimal(s+"."+ss);&lt;BR /&gt;}&lt;/PRE&gt;&lt;BR /&gt;in tMap use like below. &lt;BR /&gt;value=121212&lt;BR /&gt;&lt;PRE&gt;GetDecimalFromFixedString(row1.Inv_qty,2)&lt;/PRE&gt;&lt;BR /&gt;result 1212.12</description>
      <pubDate>Mon, 04 Mar 2013 04:52:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359199#M124068</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-03-04T04:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: String to Float conversion</title>
      <link>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359200#M124069</link>
      <description>Hi umeshrakhe, 
&lt;BR /&gt;I've created a new function and named it as GetDecimalFromFixedString as below: 
&lt;BR /&gt; 
&lt;PRE&gt;package routines;&lt;BR /&gt;import java.math.BigDecimal;&lt;BR /&gt;&lt;BR /&gt;public class GetDecimalFromFixedString &lt;BR /&gt;{&lt;BR /&gt;	public static BigDecimal GetDecimalFromFixedString(String Column,int Precision)&lt;BR /&gt;	{&lt;BR /&gt;	BigDecimal Result= new BigDecimal("0.00");&lt;BR /&gt;	String s = Column.substring(0,((Column).length()- Precision));&lt;BR /&gt;	                &lt;BR /&gt;	                 String ss =Column.replace(s, "");&lt;BR /&gt;	              Result =new BigDecimal(s+"."+ss);&lt;BR /&gt;	return Result =new BigDecimal(s+"."+ss);&lt;BR /&gt;	}&lt;BR /&gt;  &lt;BR /&gt;}&lt;/PRE&gt; 
&lt;BR /&gt;But my job returns error. I wonder what's wrong as I followed like you said. 
&lt;BR /&gt;Thanks a lot! 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MDwY.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/130831i5A91447FDB460043/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MDwY.jpg" alt="0683p000009MDwY.jpg" /&gt;&lt;/span&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MDwd.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/132364iF5A60DB473DEB26C/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MDwd.jpg" alt="0683p000009MDwd.jpg" /&gt;&lt;/span&gt;</description>
      <pubDate>Mon, 04 Mar 2013 07:16:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359200#M124069</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-03-04T07:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: String to Float conversion</title>
      <link>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359201#M124070</link>
      <description>&lt;PRE&gt;GetDecimalFromFixedString.GetDecimalFromFixedString(String Column,int Precision)&lt;/PRE&gt;
&lt;BR /&gt;try above one. one more suggestion, change the class name with something like NumericConversion so all the function will goes to this routine it will help you to manage and all the function. 
&lt;BR /&gt;try this will help to sort the problem.</description>
      <pubDate>Mon, 04 Mar 2013 08:04:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359201#M124070</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-03-04T08:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: String to Float conversion</title>
      <link>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359202#M124071</link>
      <description>Hi umeshrakhe,&lt;BR /&gt;Thanks for your help. &lt;BR /&gt;I'm sorry, I'm totally newbie to Java so could you show me the full code. Seems like I keep getting error. -_-'&lt;BR /&gt;Appreciate your feedback.</description>
      <pubDate>Mon, 04 Mar 2013 09:10:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359202#M124071</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-03-04T09:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: String to Float conversion</title>
      <link>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359203#M124072</link>
      <description>Hi Rozie, &lt;BR /&gt;All right here are steps to create all things step by step. &lt;BR /&gt;1. Create a routine named with "NumericConversion"&lt;BR /&gt;2. paste below function in it. &lt;BR /&gt;&lt;PRE&gt;public static BigDecimal GetDecimalFromFixedString(String Column,int Precision)&lt;BR /&gt;    {&lt;BR /&gt;    BigDecimal Result= new BigDecimal("0.00");&lt;BR /&gt;    String s = Column.substring(0,((Column).length()- Precision));&lt;BR /&gt;                    &lt;BR /&gt;                     String ss =Column.replace(s, "");&lt;BR /&gt;                  Result =new BigDecimal(s+"."+ss);&lt;BR /&gt;    return Result =new BigDecimal(s+"."+ss);&lt;BR /&gt;    }&lt;/PRE&gt;&lt;BR /&gt;3. import required name spaces. &lt;BR /&gt;4. open tMap and use function like below. &lt;BR /&gt;&lt;PRE&gt;yourcolumn!=null?&lt;BR /&gt;NumericConversion.GetDecimalFromFixedString(yourcolumn,decimalpointposition):new BigDecimal("0")&lt;/PRE&gt;&lt;BR /&gt;I am busy in some work so writing in very short words.</description>
      <pubDate>Mon, 04 Mar 2013 09:32:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359203#M124072</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-03-04T09:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: String to Float conversion</title>
      <link>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359204#M124073</link>
      <description>Hi umeshrakhe, 
&lt;BR /&gt;I'm sorry if my prob keeps bugging you. I'm however still receiving error. 
&lt;BR /&gt;My code follows exactly as you are: 
&lt;BR /&gt; 
&lt;PRE&gt;package routines;&lt;BR /&gt;public class NumericConversion {&lt;BR /&gt;    public static BigDecimal GetDecimalFromFixedString(String Column,int Precision)&lt;BR /&gt;    {&lt;BR /&gt;    BigDecimal Result= new BigDecimal("0.00");&lt;BR /&gt;    String s = Column.substring(0,((Column).length()- Precision));&lt;BR /&gt;                    &lt;BR /&gt;                  String ss =Column.replace(s, "");&lt;BR /&gt;                  Result =new BigDecimal(s+"."+ss);&lt;BR /&gt;    return Result =new BigDecimal(s+"."+ss);&lt;BR /&gt;    }&lt;BR /&gt;}&lt;/PRE&gt; 
&lt;BR /&gt;Attached are the image files of the errors I received. 
&lt;BR /&gt;Regards, 
&lt;BR /&gt;Rozie 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MDwi.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/146655i069D87B5321B3685/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MDwi.jpg" alt="0683p000009MDwi.jpg" /&gt;&lt;/span&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MDro.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/130472iDB5C5CA134676E75/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MDro.jpg" alt="0683p000009MDro.jpg" /&gt;&lt;/span&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MDwn.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/128192i26B698C4F911563D/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MDwn.jpg" alt="0683p000009MDwn.jpg" /&gt;&lt;/span&gt;</description>
      <pubDate>Thu, 21 Mar 2013 02:29:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359204#M124073</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-03-21T02:29:41Z</dc:date>
    </item>
    <item>
      <title>Re: String to Float conversion</title>
      <link>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359205#M124074</link>
      <description>Hi Rozie
&lt;BR /&gt;It is a compilation error here, use java.util.BigDecimal instead of BigDecimal in your routine
&lt;BR /&gt;for example:
&lt;BR /&gt;
&lt;PRE&gt; BigDecimal Result= new BigDecimal("0.00");&lt;/PRE&gt;
&lt;BR /&gt;to 
&lt;BR /&gt;
&lt;PRE&gt; java.math.BigDecimal Result= new java.math.BigDecimal("0.00");&lt;/PRE&gt;
&lt;BR /&gt;Shong</description>
      <pubDate>Fri, 22 Mar 2013 07:07:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/String-to-Float-conversion/m-p/2359205#M124074</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-03-22T07:07:19Z</dc:date>
    </item>
  </channel>
</rss>

