<?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 Double conversion and validation in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/String-to-Double-conversion-and-validation/m-p/2210417#M8847</link>
    <description>try with &lt;BR /&gt;&lt;BR /&gt;Double.parseDouble(name_of_your_input_field)&lt;BR /&gt;or&lt;BR /&gt;new BigDecimal(name_of_your_input_field).doubleValue()&lt;BR /&gt;&lt;BR /&gt;Add round if it needs to be rounded&lt;BR /&gt;&lt;BR /&gt;It worked for me</description>
    <pubDate>Mon, 10 Jan 2011 13:33:43 GMT</pubDate>
    <dc:creator>veryimportantdude</dc:creator>
    <dc:date>2011-01-10T13:33:43Z</dc:date>
    <item>
      <title>String to Double conversion and validation</title>
      <link>https://community.qlik.com/t5/Talend-Studio/String-to-Double-conversion-and-validation/m-p/2210416#M8846</link>
      <description>I am having trouble determining the correct functions and syntax for tMap Expressions to convert flat file String data types to Decimal data types. 
&lt;BR /&gt;I am reading delimited files with Strings values. These are being inserted into a database with columns defined as Decimal (12,2). 
&lt;BR /&gt;I need to develop a common tMap expression that I can use to cleanse the data, and convert the Strings into Decimals. 
&lt;BR /&gt;This is a JAVA project. 
&lt;BR /&gt; 
&lt;BR /&gt;Examples of INPUT data: 
&lt;BR /&gt;"" (empty string) 
&lt;BR /&gt;null 
&lt;BR /&gt;"$12" 
&lt;BR /&gt;"$12.34" 
&lt;BR /&gt;" $12.34 " 
&lt;BR /&gt;"12" 
&lt;BR /&gt;"12.34" 
&lt;BR /&gt;" 12.34 " 
&lt;BR /&gt;"1,234.56" 
&lt;BR /&gt;"$1,234.56" 
&lt;BR /&gt;These need to cleansed and converted to Decimal(12,2) values. 
&lt;BR /&gt;Please assist me with a tMap Expression that will take any of the above examples and properly convert it to a Decimal value.</description>
      <pubDate>Sat, 16 Nov 2024 13:09:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/String-to-Double-conversion-and-validation/m-p/2210416#M8846</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T13:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: String to Double conversion and validation</title>
      <link>https://community.qlik.com/t5/Talend-Studio/String-to-Double-conversion-and-validation/m-p/2210417#M8847</link>
      <description>try with &lt;BR /&gt;&lt;BR /&gt;Double.parseDouble(name_of_your_input_field)&lt;BR /&gt;or&lt;BR /&gt;new BigDecimal(name_of_your_input_field).doubleValue()&lt;BR /&gt;&lt;BR /&gt;Add round if it needs to be rounded&lt;BR /&gt;&lt;BR /&gt;It worked for me</description>
      <pubDate>Mon, 10 Jan 2011 13:33:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/String-to-Double-conversion-and-validation/m-p/2210417#M8847</guid>
      <dc:creator>veryimportantdude</dc:creator>
      <dc:date>2011-01-10T13:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: String to Double conversion and validation</title>
      <link>https://community.qlik.com/t5/Talend-Studio/String-to-Double-conversion-and-validation/m-p/2210418#M8848</link>
      <description>I'm getting java.lang.Error: Unresolved compilation problems when trying this Expression.
&lt;BR /&gt;Source column: row.Net_Sales, type String
&lt;BR /&gt;Target column: Net_Sales, type Decimal(10,2)
&lt;BR /&gt;The tMap expression is:
&lt;BR /&gt;Double.parseDouble(row.Net_Sales) 
&lt;BR /&gt;I've also tried 
&lt;BR /&gt;new BigDecimal(row.Net_Sales).doubleValue()
&lt;BR /&gt;and that errors with: java.lang.Error: Unresolved compilation problems: 
&lt;BR /&gt;
&lt;BR /&gt;Also, Please note the list of possible SOURCE data value examples. I need an Expression that will handle the full list, including NULL, EMPTY STRING, and others listed in my earlier post.</description>
      <pubDate>Mon, 10 Jan 2011 15:53:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/String-to-Double-conversion-and-validation/m-p/2210418#M8848</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-01-10T15:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: String to Double conversion and validation</title>
      <link>https://community.qlik.com/t5/Talend-Studio/String-to-Double-conversion-and-validation/m-p/2210419#M8849</link>
      <description>hi , 
&lt;BR /&gt;please avoid 
&lt;A href="https://community.qlik.com/s/feed/0D53p00007vClGnCAK" target="_blank" rel="nofollow noopener noreferrer"&gt;https://community.talend.com/t5/Design-and-Development/resolved-String-to-Double-conversion-failing/td-p/78424&lt;/A&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MA9p.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/138034i5F552429DA646D6F/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MA9p.png" alt="0683p000009MA9p.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;First, before convert your value, you have to clean your date. 
&lt;BR /&gt;In a metadata delimited file create schema and escape double quote . 
&lt;BR /&gt;In regex replace all non numeric value. 
&lt;BR /&gt;Like you have to only keep numeric delimiter caracter (only decimal one) , your regex coulb be something like : 
&lt;BR /&gt; 
&lt;PRE&gt;&lt;/PRE&gt; 
&lt;BR /&gt;now your have white space into your code , so trim them 
&lt;BR /&gt;Now you can convert result into Double ... 
&lt;BR /&gt;but you'll got an error due to empty string , so you have to filter those "pollution" 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;hopefully you can update your metadata and check "ignore empty string" ! 
&lt;BR /&gt;you'll may be have also to parse null value (real null value and not field with a string null). 
&lt;BR /&gt;so into your tMap parse string with : 
&lt;BR /&gt; 
&lt;PRE&gt;Double.parseDouble(row1.escapedQuote.replaceAll("", "").trim())&lt;/PRE&gt; 
&lt;BR /&gt;and filter in dataflow with filter : 
&lt;BR /&gt; 
&lt;PRE&gt; !row1.escapedQuote.equals("null")&lt;/PRE&gt; 
&lt;BR /&gt;conclusion : split your problem into atomics ones to resolve them 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;regards 
&lt;BR /&gt;laurent</description>
      <pubDate>Mon, 10 Jan 2011 22:09:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/String-to-Double-conversion-and-validation/m-p/2210419#M8849</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-01-10T22:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: String to Double conversion and validation</title>
      <link>https://community.qlik.com/t5/Talend-Studio/String-to-Double-conversion-and-validation/m-p/2210420#M8850</link>
      <description>Hi! all
&lt;BR /&gt;how to split the column numeric value and string value in talend.
&lt;BR /&gt;i have an input example wat652son. but i have output is name=watson and number=652 anyone help me</description>
      <pubDate>Thu, 24 Sep 2015 12:16:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/String-to-Double-conversion-and-validation/m-p/2210420#M8850</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-09-24T12:16:09Z</dc:date>
    </item>
  </channel>
</rss>

