<?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 select only maximum value from tMap? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345239#M112795</link>
    <description>@TRF, Hello! Sorry for the late reply. 
&lt;BR /&gt;Table2 will be updated frequently(new rows will be added to it). 
&lt;BR /&gt;Is there a way to create the newTable2 such that it will always work just by&amp;nbsp;clicking the run button without modifying anything when Table2 is updated?</description>
    <pubDate>Thu, 30 Mar 2017 02:45:23 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-03-30T02:45:23Z</dc:date>
    <item>
      <title>[resolved] How to select only maximum value from tMap?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345231#M112787</link>
      <description>Hi All,&lt;BR /&gt;I would like to select only the maximum value of num.&lt;BR /&gt;num column is located in table2.&lt;BR /&gt;&lt;BR /&gt;Here is an sql example:&lt;BR /&gt;select max(num)&lt;BR /&gt;from table1 left join table2&lt;BR /&gt;on (condition1&amp;gt;condition2)&lt;BR /&gt;&lt;BR /&gt;I&amp;nbsp;have tried&amp;nbsp;performing the above sql using tMap.&lt;BR /&gt;table1 --&amp;gt; tMap --&amp;gt; table3&lt;BR /&gt;table2(lookup)&lt;BR /&gt;&lt;BR /&gt;I have no problem trying to do a left join of table1 and table2 and I manage to include the condition at the filter in tMap. However, I do not know how to get the max(num).&lt;BR /&gt;Table3 have an empty num column where I can input the max(num) into.&lt;BR /&gt;Please help.</description>
      <pubDate>Wed, 29 Mar 2017 08:56:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345231#M112787</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-29T08:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to select only maximum value from tMap?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345232#M112788</link>
      <description>Hi,&lt;BR /&gt;As tMap process records one at a time it is not the place to do that.&lt;BR /&gt;You may:&lt;BR /&gt;- get the max value into a global variable before entering into the tMap using SQL, then filtering with that variable&lt;BR /&gt;- select the values from SQL, then sort descending and process for the 1rst row only&lt;BR /&gt;Regards,&lt;BR /&gt;TRF</description>
      <pubDate>Wed, 29 Mar 2017 09:11:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345232#M112788</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2017-03-29T09:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to select only maximum value from tMap?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345233#M112789</link>
      <description>@TRF Hello! thank you for replying. how do I make it to process for 1st row only?</description>
      <pubDate>Wed, 29 Mar 2017 09:15:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345233#M112789</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-29T09:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to select only maximum value from tMap?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345234#M112790</link>
      <description>just add a tSampleRow before the tMap with the folloging parameter "1"</description>
      <pubDate>Wed, 29 Mar 2017 09:25:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345234#M112790</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2017-03-29T09:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to select only maximum value from tMap?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345235#M112791</link>
      <description>@TRF, I tried the tSampleRow&amp;nbsp;but couldn't get the output required. This is an example of the table output required:
&lt;BR /&gt;
&lt;A href="https://community.talend.com/legacyfs/online/membersTempo/419760/Capture_20170329-0148.png" target="_blank"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/A&gt;
&lt;BR /&gt;Thanks.</description>
      <pubDate>Wed, 29 Mar 2017 09:49:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345235#M112791</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-29T09:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to select only maximum value from tMap?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345236#M112792</link>
      <description>I don't understand your use case. 
&lt;BR /&gt;Can you be more explicit?</description>
      <pubDate>Wed, 29 Mar 2017 10:10:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345236#M112792</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2017-03-29T10:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to select only maximum value from tMap?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345237#M112793</link>
      <description>@TRF, sure! (:&lt;BR /&gt;From table2,&lt;BR /&gt;We will be able to get the info that any dates from 2017-02-01 to 2017-03-01, num =11&lt;BR /&gt;and&lt;BR /&gt;any dates from 2017-03-02 to 2017-04-01, num =12&lt;BR /&gt;Therefore, for the output table3, we have to&amp;nbsp;get the&amp;nbsp;num from table2 for the dates in table 1.&lt;BR /&gt;e.g for 2017-02-15, num = 11&lt;BR /&gt;for 2017-03-15, num = 12</description>
      <pubDate>Wed, 29 Mar 2017 10:32:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345237#M112793</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-29T10:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to select only maximum value from tMap?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345238#M112794</link>
      <description>Well, a little bit more complicated than a simple tMap join as you expect a date comprised between 2 others (tMap join use equality). 
&lt;BR /&gt;First, you need to construct an intermediate table for table2 with the following values: 
&lt;BR /&gt;num &amp;nbsp; &amp;nbsp;startDate &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;endDate 
&lt;BR /&gt;11 &amp;nbsp; &amp;nbsp; &amp;nbsp;1900-01-01 &amp;nbsp; &amp;nbsp; 2017-02-01 
&lt;BR /&gt;12 &amp;nbsp; &amp;nbsp; &amp;nbsp;2017-02-01 &amp;nbsp; &amp;nbsp; 2017-03-01 
&lt;BR /&gt;13 &amp;nbsp; &amp;nbsp; &amp;nbsp;2017-03-01 &amp;nbsp; &amp;nbsp; 2017-04-01 
&lt;BR /&gt;tSortRows and tMemorizeRows should help you for that. 
&lt;BR /&gt;Now, try this: 
&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;row2(newTable2) 
&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | 
&lt;BR /&gt;row1(Table1) --&amp;gt; tMap --&amp;gt; the result 
&lt;BR /&gt;Add a filter to Table2 as the following: 
&lt;BR /&gt; 
&lt;PRE&gt;row1.Date.compareTo(row2.startDate) &amp;gt; 0 &amp;amp;&amp;amp;&amp;nbsp;row1.Date.compareTo(row2.endDate) &amp;lt;= 0&lt;/PRE&gt; 
&lt;BR /&gt; 
&lt;BR /&gt;It is the principle, &amp;nbsp;I've not tried but should work (I hope so). 
&lt;BR /&gt;Regards, 
&lt;BR /&gt;TRF</description>
      <pubDate>Wed, 29 Mar 2017 11:30:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345238#M112794</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2017-03-29T11:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to select only maximum value from tMap?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345239#M112795</link>
      <description>@TRF, Hello! Sorry for the late reply. 
&lt;BR /&gt;Table2 will be updated frequently(new rows will be added to it). 
&lt;BR /&gt;Is there a way to create the newTable2 such that it will always work just by&amp;nbsp;clicking the run button without modifying anything when Table2 is updated?</description>
      <pubDate>Thu, 30 Mar 2017 02:45:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345239#M112795</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-30T02:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to select only maximum value from tMap?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345240#M112796</link>
      <description>Hi,
&lt;BR /&gt;You don't have to create and fill a new table. newTable2 is a tHash which is an in memory object on Talend side.
&lt;BR /&gt;Using a tJavaRow you can complete this newTable2 like this:
&lt;BR /&gt;
&lt;PRE&gt;output_row.num = input_row.num;&lt;BR /&gt;output_row.endDate = input_row.date;&lt;BR /&gt;output_row.startDate = ((String)globalMap.get("startDate"));&lt;BR /&gt;globalMap.put("startDate", input_row.date);&lt;BR /&gt;&lt;/PRE&gt;
&lt;BR /&gt;Global variable "startDate" is initialized with&amp;nbsp;"1900-01-01" when job starts.</description>
      <pubDate>Thu, 30 Mar 2017 09:17:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345240#M112796</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2017-03-30T09:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to select only maximum value from tMap?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345241#M112797</link>
      <description>@TRF,&amp;nbsp;It's working! Thanks a lot for your explanation once again! (:</description>
      <pubDate>Thu, 30 Mar 2017 10:21:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345241#M112797</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-30T10:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to select only maximum value from tMap?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345242#M112798</link>
      <description>Tell what is your database (oracle? mySQL ? postgreSQL ? other ?)&lt;BR /&gt;One way should be to convert from date to string, or better to integer, when selecting from table.&lt;BR /&gt;You tSetGlobalVar to initialize a global variable.</description>
      <pubDate>Thu, 30 Mar 2017 11:17:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345242#M112798</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2017-03-30T11:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to select only maximum value from tMap?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345243#M112799</link>
      <description>@TRF, I manage to get it work with your working.&lt;BR /&gt;Just that I used context.date instead of globalMap. I made some mistake in the code for context.date and that is why there is error message. But it's working now! Thanks!</description>
      <pubDate>Thu, 30 Mar 2017 11:19:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345243#M112799</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-03-30T11:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to select only maximum value from tMap?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345244#M112800</link>
      <description>You're welcome</description>
      <pubDate>Thu, 30 Mar 2017 11:45:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-select-only-maximum-value-from-tMap/m-p/2345244#M112800</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2017-03-30T11:45:11Z</dc:date>
    </item>
  </channel>
</rss>

