<?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: [resolved] How to make float round to 2 decimal places in tMap? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-make-float-round-to-2-decimal-places-in-tMap/m-p/2350566#M117408</link>
    <description>Try this one..... round a number to 2 decimal places
&lt;BR /&gt;Mercal&amp;nbsp;</description>
    <pubDate>Tue, 09 Jun 2015 07:05:23 GMT</pubDate>
    <dc:creator>_AnonymousUser</dc:creator>
    <dc:date>2015-06-09T07:05:23Z</dc:date>
    <item>
      <title>[resolved] How to make float round to 2 decimal places in tMap?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-make-float-round-to-2-decimal-places-in-tMap/m-p/2350563#M117405</link>
      <description>Hi, I tried setting length to 5 and precision to 2 (just guessing), but that didn't affect my output number at all 
&lt;BR /&gt;I'm getting 6 decimal places now with no length or precision settings 
&lt;BR /&gt;Thanks 
&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;</description>
      <pubDate>Thu, 22 May 2014 21:22:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-make-float-round-to-2-decimal-places-in-tMap/m-p/2350563#M117405</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-05-22T21:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to make float round to 2 decimal places in tMap?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-make-float-round-to-2-decimal-places-in-tMap/m-p/2350564#M117406</link>
      <description>Hello, ensure that your columns are BigDecimal types first.  Then on the far side of a tMap or other component use something like: &lt;PRE&gt;input_row.column.scale(2,BigDecimal.ROUND_HALF_UP)&lt;/PRE&gt;&lt;BR /&gt;As an example, I put the following into a tJava to test it and got the results you're looking for:&lt;BR /&gt;&lt;PRE&gt;BigDecimal bd = new BigDecimal(2.437732);&lt;BR /&gt;BigDecimal bd2 = bd.setScale(2,BigDecimal.ROUND_HALF_UP);&lt;BR /&gt;System.out.println("bd2 = "+bd2);&lt;/PRE&gt;&lt;BR /&gt;and it outputs:&lt;BR /&gt;&lt;PRE&gt;Starting job test at 17:13 22/05/2014.&lt;BR /&gt; connecting to socket on port 3511&lt;BR /&gt; connected&lt;BR /&gt;bd2 = 2.44&lt;BR /&gt; disconnected&lt;BR /&gt;Job test ended at 17:13 22/05/2014. &lt;/PRE&gt;</description>
      <pubDate>Thu, 22 May 2014 22:15:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-make-float-round-to-2-decimal-places-in-tMap/m-p/2350564#M117406</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-05-22T22:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to make float round to 2 decimal places in tMap?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-make-float-round-to-2-decimal-places-in-tMap/m-p/2350565#M117407</link>
      <description>Thanks for that, this is a handy reference 
&lt;BR /&gt;For this Job... 
&lt;BR /&gt;... While originally testing with a CSV file, I have found that MySQL dealt with adequately it by making it a 'decimal' db data type and limiting the length to "5,2" 
&lt;BR /&gt;I will mark the thread "resolved" ? would mark it "double resolved" if I could! 
&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;</description>
      <pubDate>Thu, 22 May 2014 22:36:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-make-float-round-to-2-decimal-places-in-tMap/m-p/2350565#M117407</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-05-22T22:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to make float round to 2 decimal places in tMap?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-make-float-round-to-2-decimal-places-in-tMap/m-p/2350566#M117408</link>
      <description>Try this one..... round a number to 2 decimal places
&lt;BR /&gt;Mercal&amp;nbsp;</description>
      <pubDate>Tue, 09 Jun 2015 07:05:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-make-float-round-to-2-decimal-places-in-tMap/m-p/2350566#M117408</guid>
      <dc:creator>_AnonymousUser</dc:creator>
      <dc:date>2015-06-09T07:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to make float round to 2 decimal places in tMap?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-make-float-round-to-2-decimal-places-in-tMap/m-p/2350567#M117409</link>
      <description>&lt;P&gt;If they are floats, you don't need to turn them into bigdecimals.&lt;/P&gt;&lt;P&gt;You could easily use Math.round().&lt;/P&gt;&lt;P&gt;I'll explain:&lt;/P&gt;&lt;P&gt;Var1 is type float. &lt;/P&gt;&lt;P&gt;&lt;B&gt;&lt;U&gt;Var1 = 2,539&lt;/U&gt;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;Math.round(Var1) is 3&lt;/P&gt;&lt;P&gt;Var1 * 100 is 253,9&lt;/P&gt;&lt;P&gt;This means that Math.round(Var1 * 100) is 254&lt;/P&gt;&lt;P&gt;This also means that Math.round(Var1 * 100) / 100 is 2,54&lt;/P&gt;&lt;P&gt;So, if you want to round a float to 2 decimal places, do this:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Var2 = Math.round(Var1 * 100) / 100&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;B&gt;&lt;U&gt;Var2 = 2,54&lt;/U&gt;&lt;/B&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Aug 2023 17:48:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-make-float-round-to-2-decimal-places-in-tMap/m-p/2350567#M117409</guid>
      <dc:creator>RMotta2408</dc:creator>
      <dc:date>2023-08-23T17:48:47Z</dc:date>
    </item>
  </channel>
</rss>

