<?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: Record for Max() in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Record-for-Max/m-p/596579#M220978</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;in the script is easier than in objects:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose that your table (myTable) has field ID, &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;SF,NATION,STATE&lt;/SPAN&gt; as primary Key:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TempTab:&lt;/P&gt;&lt;P&gt;Load ID,&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;SF,NATION,STATE&lt;/SPAN&gt; Max(RUN_ID) as RUN_ID Resident myTable group by ID,&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;SF,NATION,STATE&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load * resident myTable;&lt;/P&gt;&lt;P&gt;left join&lt;/P&gt;&lt;P&gt;Load *, '1' as flagMax resident TempTab;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drop table temptab;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you can use in object simply the flag "flagMax" to write needed rows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Mar 2014 11:55:26 GMT</pubDate>
    <dc:creator>alexandros17</dc:creator>
    <dc:date>2014-03-04T11:55:26Z</dc:date>
    <item>
      <title>Record for Max()</title>
      <link>https://community.qlik.com/t5/QlikView/Record-for-Max/m-p/596576#M220975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi All,&lt;/P&gt;&lt;P&gt;I want to fetch only those records from the DB where the RUN_ID=maximum.&lt;/P&gt;&lt;P&gt;e.g-I have five fields like ID,SF,NATION,STATE,RUN_ID where RUN_ID=1,2,3.. etc.&lt;/P&gt;&lt;P&gt;I want to pull the records for ID,SF,NATION,STATE if(RUN_ID=3)Everytime i refresh,i don't want to update this RUN_ID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can i use Max(Run_ID) or any suggestions?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2014 11:42:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Record-for-Max/m-p/596576#M220975</guid>
      <dc:creator />
      <dc:date>2014-03-04T11:42:47Z</dc:date>
    </item>
    <item>
      <title>Re: Record for Max()</title>
      <link>https://community.qlik.com/t5/QlikView/Record-for-Max/m-p/596577#M220976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Though I did not understand exactly what you meant by:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;Everytime i refresh,i don't want to update this RUN_ID.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;In a generic way, you can try like:&lt;/P&gt;&lt;P&gt;Max:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Max(RUN_ID) as MaxID&lt;/P&gt;&lt;P&gt;from &amp;lt;&amp;gt;;&lt;/P&gt;&lt;P&gt;Let vMax=Peek('MaxID');&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *&lt;/P&gt;&lt;P&gt;From &amp;lt;&amp;gt; Where RUN_ID=$(vMax);&lt;/P&gt;&lt;P&gt;Drop Table Max;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2014 11:52:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Record-for-Max/m-p/596577#M220976</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2014-03-04T11:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: Record for Max()</title>
      <link>https://community.qlik.com/t5/QlikView/Record-for-Max/m-p/596578#M220977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can use a sub-query:&lt;/P&gt;&lt;P&gt;LOAD *;&lt;/P&gt;&lt;P&gt;SQL&lt;/P&gt;&lt;P&gt;select &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;ID,SF,NATION,STATE,RUN_ID&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;from table&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;where RUN_ID = (select MAX(RUN_ID) from table);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Angad&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2014 11:53:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Record-for-Max/m-p/596578#M220977</guid>
      <dc:creator />
      <dc:date>2014-03-04T11:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: Record for Max()</title>
      <link>https://community.qlik.com/t5/QlikView/Record-for-Max/m-p/596579#M220978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;in the script is easier than in objects:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose that your table (myTable) has field ID, &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;SF,NATION,STATE&lt;/SPAN&gt; as primary Key:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TempTab:&lt;/P&gt;&lt;P&gt;Load ID,&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;SF,NATION,STATE&lt;/SPAN&gt; Max(RUN_ID) as RUN_ID Resident myTable group by ID,&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;SF,NATION,STATE&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Load * resident myTable;&lt;/P&gt;&lt;P&gt;left join&lt;/P&gt;&lt;P&gt;Load *, '1' as flagMax resident TempTab;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Drop table temptab;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you can use in object simply the flag "flagMax" to write needed rows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2014 11:55:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Record-for-Max/m-p/596579#M220978</guid>
      <dc:creator>alexandros17</dc:creator>
      <dc:date>2014-03-04T11:55:26Z</dc:date>
    </item>
  </channel>
</rss>

