<?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: Load and  select in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Load-and-select/m-p/868040#M303631</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you will be speed up these loading if you made the sql-statement outside from loop and looped then over a resident-table maybe like this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tempSQL:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sql select f1,f2,f3,f4 from Db&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;where Year(Salesdate)&amp;gt;=(year(Current_Date)-1) and Salesdate&amp;lt;=Current_Date;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Table:&lt;/P&gt;&lt;P&gt;load distinct monthname(SalesDate) as Monthname Resident tempSQL;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let vCount = noofrows('Table');&lt;/P&gt;&lt;P&gt;for i =0 to $(i)&lt;/P&gt;&lt;P&gt;let vmonth = peek('Table',$(i),'Monthname');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [$(vmonth)]:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; noconcatenate &lt;/STRONG&gt;load * Resident tempSQL where monthname(SalesDate)='$(vMonth)';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Store [$(vmonth)] into [$(vmonth)].qvd(qvd);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; drop table [$(vmonth)];&lt;/P&gt;&lt;P&gt;next &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More speed could be possible if you stored the tempSQL as qvd and load from there especially if you added the Monthname or an equivalent within the SQL-SELECT and used this field to loop over the complete-data and as a filter-statement within a where exists clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 21 Jun 2015 13:21:28 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2015-06-21T13:21:28Z</dc:date>
    <item>
      <title>Load and  select</title>
      <link>https://community.qlik.com/t5/QlikView/Load-and-select/m-p/868036#M303627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am breaking the SalesDate into monthly data in loop (Assume salesdate consists of 12months data then i am seperating each month's data into seperate qvd and naming it as the same month name ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My Sample code is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table:&lt;/P&gt;&lt;P&gt;load distinct monthname(SalesDate) as Monthname;&lt;/P&gt;&lt;P&gt;sql select SalesDate from Db;&lt;/P&gt;&lt;P&gt;let vCount = noofrows('Table');&lt;/P&gt;&lt;P&gt;for i =0 to $(i)&lt;/P&gt;&lt;P&gt;let vmonth = peek('Table',$(i),'Monthname');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[$(vmonth)]:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;load * where monthname(SalesDate)='$(vMonth)';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sql select f1,f2,f3,f4 &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;where Year(Salesdate)&amp;gt;=(year(Current_Date)-1) and Salesdate&amp;lt;=Current_Date;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Store [$(vmonth)] into &lt;STRONG&gt;[$(vmonth)].qvd(qvd);&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG&gt;drop table &lt;STRONG&gt;[$(vmonth)];&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;next &lt;/STRONG&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;now when i am executing the code it's taking more time to load for each month .Any help is appreciated&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Jun 2015 12:54:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-and-select/m-p/868036#M303627</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-21T12:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: Load and  select</title>
      <link>https://community.qlik.com/t5/QlikView/Load-and-select/m-p/868037#M303628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is the problem that it is taking lot of time to execute or is it giving you an error?&lt;/P&gt;&lt;P&gt;The one thing that stands out: You have used &lt;STRONG&gt;FOR i = 0 to $(i),&lt;/STRONG&gt; I think you wanted to say &lt;STRONG&gt;FOR i = 1 to $(vCount)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Other than that it seems right, except there might be an issue with how the variables are used, to troubleshoot any issue there we would need to know are you getting any errors? If yes than where exactly are you getting it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Jun 2015 13:09:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-and-select/m-p/868037#M303628</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-06-21T13:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: Load and  select</title>
      <link>https://community.qlik.com/t5/QlikView/Load-and-select/m-p/868038#M303629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One more thing, I would probably add the where statement to your first Table load so that only those month-year are loaded which you are late going to use in your qvd generation loop:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;Table:&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;LOAD Distinct MonthName(SalesDate) as Monthname;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;SQL Select SalesDate from Db&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;Where Year(Salesdate)&amp;gt;=(Year(Current_Date)-1) and Salesdate&amp;lt;=Current_Date;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Jun 2015 13:13:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-and-select/m-p/868038#M303629</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-06-21T13:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: Load and  select</title>
      <link>https://community.qlik.com/t5/QlikView/Load-and-select/m-p/868039#M303630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In addition, I think your second SQL SELECT should use a WHERE clause that limits the query to the YearMonth you are actually interested in, thus avoiding to retrieve data for months you filter in your preceding LOAD statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Jun 2015 13:18:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-and-select/m-p/868039#M303630</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2015-06-21T13:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: Load and  select</title>
      <link>https://community.qlik.com/t5/QlikView/Load-and-select/m-p/868040#M303631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you will be speed up these loading if you made the sql-statement outside from loop and looped then over a resident-table maybe like this way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tempSQL:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;sql select f1,f2,f3,f4 from Db&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;where Year(Salesdate)&amp;gt;=(year(Current_Date)-1) and Salesdate&amp;lt;=Current_Date;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Table:&lt;/P&gt;&lt;P&gt;load distinct monthname(SalesDate) as Monthname Resident tempSQL;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let vCount = noofrows('Table');&lt;/P&gt;&lt;P&gt;for i =0 to $(i)&lt;/P&gt;&lt;P&gt;let vmonth = peek('Table',$(i),'Monthname');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [$(vmonth)]:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; noconcatenate &lt;/STRONG&gt;load * Resident tempSQL where monthname(SalesDate)='$(vMonth)';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Store [$(vmonth)] into [$(vmonth)].qvd(qvd);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; drop table [$(vmonth)];&lt;/P&gt;&lt;P&gt;next &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;More speed could be possible if you stored the tempSQL as qvd and load from there especially if you added the Monthname or an equivalent within the SQL-SELECT and used this field to loop over the complete-data and as a filter-statement within a where exists clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Jun 2015 13:21:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-and-select/m-p/868040#M303631</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2015-06-21T13:21:28Z</dc:date>
    </item>
    <item>
      <title>Re: Load and  select</title>
      <link>https://community.qlik.com/t5/QlikView/Load-and-select/m-p/868041#M303632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of the doing the &lt;EM&gt;distinct monthname(SalesDate)&lt;/EM&gt; in QlikView you could back that off to the database and get the &lt;EM&gt;sql&lt;/EM&gt; to only return to QlikView the distinct MonthYear.&amp;nbsp; Your way you will be returning a row for every table row, which is inefficient at every level.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Similarly in the loop you in every pass &lt;SPAN style="font-size: 13.3333330154419px;"&gt;repeatedly &lt;/SPAN&gt;extract and drop all the sales data year to date.&amp;nbsp; This will take longer and longer as the year progresses and you have more months to process&amp;nbsp; You could either do the sql extract once before the loop and load from resident in the loop.&amp;nbsp; Or generate sql that only returns data for the month in question from the database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your sql for the sales data extract does not have a from clause, I guess that was typo in your post.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Jun 2015 13:24:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-and-select/m-p/868041#M303632</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-21T13:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: Load and  select</title>
      <link>https://community.qlik.com/t5/QlikView/Load-and-select/m-p/868042#M303633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sunny ,&lt;/P&gt;&lt;P&gt;It is for i= 0 to $(Count).Its my mistake.&lt;/P&gt;&lt;P&gt;Yes it is taking more time to load records .Example :for 1lakh records it is taking 4mins.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jun 2015 05:27:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-and-select/m-p/868042#M303633</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-22T05:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: Load and  select</title>
      <link>https://community.qlik.com/t5/QlikView/Load-and-select/m-p/868043#M303634</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be you should follow what &lt;A _jive_internal="true" href="https://community.qlik.com/people/Marcus_Sommer"&gt;Marcus Sommer&lt;/A&gt;‌ and &lt;A _jive_internal="true" href="https://community.qlik.com/people/bill.markham"&gt;Bill Markham&lt;/A&gt;‌ has prescribed you. That may help you fasten up things.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Jun 2015 10:04:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Load-and-select/m-p/868043#M303634</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-06-22T10:04:11Z</dc:date>
    </item>
  </channel>
</rss>

