<?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: How to split a huge qvd file into multiple qvds in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/How-to-split-a-huge-qvd-file-into-multiple-qvds/m-p/1929299#M76510</link>
    <description>&lt;P&gt;For the future I highly suggest you to read this thread:&amp;nbsp;&lt;A href="https://qlikviewcookbook.com/2022/03/how-to-segment-qvd-files/" target="_self"&gt;HOW TO SEGMENT QVD FILES&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then... this approach works:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;InitalQVD:
NoConcatenate
Load 
	YEAR,
    rand() as Sales
Inline [
YEAR
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022];


DistinctYears:
Load
	Concat(Chr(39)&amp;amp;YEAR&amp;amp;chr(39),',') as YEARS
    Group by BlockSize;
LOAD Distinct 
	YEAR,
    Ceil(RecNo(),3) as BlockSize
Resident InitalQVD
	Order by YEAR asc;

For i=0 to NoOfRows('DistinctYears')-1
	let vYears=peek('YEARS',i,'DistinctYears');
    let vTableName=replace(Replace('$(vYears)',',','_'),Chr(39),'');
    
    '$(vTableName)':
    NoConcatenate
    Load *
    Resident InitalQVD
    	Where Match(YEAR,$(vYears));
    
    Store '$(vTableName)' into '$(vTableName)'.qvd(qvd);
    Drop Table '$(vTableName)';
Next
Drop Table DistinctYears;
Drop Table InitalQVD;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 11 May 2022 14:30:40 GMT</pubDate>
    <dc:creator>micheledenardi</dc:creator>
    <dc:date>2022-05-11T14:30:40Z</dc:date>
    <item>
      <title>How to split a huge qvd file into multiple qvds</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-split-a-huge-qvd-file-into-multiple-qvds/m-p/1929258#M76505</link>
      <description>&lt;P&gt;Hi, I have a qvd with 15 years of sales data so far, it keeps storing data, and I would like to process the qvd and split it into multiple qvds, and each qvd having 3 years of data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I already found a way to split the qvd into yearly qvds. Each qvd has a different year:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SALES_YEAR:&lt;BR /&gt;LOAD&lt;BR /&gt;min(YEAR) as MinYEAR,&lt;BR /&gt;max(YEAR) as MaxYEAR&lt;BR /&gt;FROM ......;&lt;/P&gt;
&lt;P&gt;LET minyear= PEEK('MinYEAR',0,'SALES_YEAR');&lt;BR /&gt;LET maxyear= PEEK('MaxYEAR',0,'SALES_YEAR');&lt;/P&gt;
&lt;P&gt;DROP TABLE SALES_YEAR;&lt;/P&gt;
&lt;P&gt;for&lt;/P&gt;
&lt;P&gt;vyear = $(minyear) to $(maxyear);&lt;/P&gt;
&lt;P&gt;SALES:&lt;BR /&gt;LOAD&lt;BR /&gt;*&lt;BR /&gt;FROM .....&lt;BR /&gt;&lt;BR /&gt;where YEAR = $(vyear);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Store SALES into [lib://......../SALES_$(vyear).qvd](qvd);&lt;BR /&gt;drop table SALES;&lt;/P&gt;
&lt;P&gt;next&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That worked perfect, but I can't think a solution in order to have each qvd containing 3 years.&lt;/P&gt;
&lt;P&gt;2010-2012, 2013-2015,........&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would appreciate some help,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Francisco.&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 13:27:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-split-a-huge-qvd-file-into-multiple-qvds/m-p/1929258#M76505</guid>
      <dc:creator>FranciscoQ</dc:creator>
      <dc:date>2022-05-11T13:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to split a huge qvd file into multiple qvds</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-split-a-huge-qvd-file-into-multiple-qvds/m-p/1929299#M76510</link>
      <description>&lt;P&gt;For the future I highly suggest you to read this thread:&amp;nbsp;&lt;A href="https://qlikviewcookbook.com/2022/03/how-to-segment-qvd-files/" target="_self"&gt;HOW TO SEGMENT QVD FILES&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then... this approach works:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;InitalQVD:
NoConcatenate
Load 
	YEAR,
    rand() as Sales
Inline [
YEAR
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022];


DistinctYears:
Load
	Concat(Chr(39)&amp;amp;YEAR&amp;amp;chr(39),',') as YEARS
    Group by BlockSize;
LOAD Distinct 
	YEAR,
    Ceil(RecNo(),3) as BlockSize
Resident InitalQVD
	Order by YEAR asc;

For i=0 to NoOfRows('DistinctYears')-1
	let vYears=peek('YEARS',i,'DistinctYears');
    let vTableName=replace(Replace('$(vYears)',',','_'),Chr(39),'');
    
    '$(vTableName)':
    NoConcatenate
    Load *
    Resident InitalQVD
    	Where Match(YEAR,$(vYears));
    
    Store '$(vTableName)' into '$(vTableName)'.qvd(qvd);
    Drop Table '$(vTableName)';
Next
Drop Table DistinctYears;
Drop Table InitalQVD;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 14:30:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-split-a-huge-qvd-file-into-multiple-qvds/m-p/1929299#M76510</guid>
      <dc:creator>micheledenardi</dc:creator>
      <dc:date>2022-05-11T14:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to split a huge qvd file into multiple qvds</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-split-a-huge-qvd-file-into-multiple-qvds/m-p/1929314#M76511</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The approach shared by &lt;STRONG&gt;micheledenardi &lt;/STRONG&gt;is very good and I recommend taking a look at it. However, if you are looking for a way to modify the script that you already have, so that you could generate the QVDs based on 3 year ranges, then you can use step in your &lt;SPAN style="color:hsl(210, 75%, 60%);"&gt;&lt;STRONG&gt;For..Next&lt;/STRONG&gt;&lt;/SPAN&gt; statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the example of the modified script:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color:hsl(210, 75%, 60%);"&gt;&lt;STRONG&gt;FOR &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color:hsl(30, 75%, 60%);"&gt;&lt;STRONG&gt;vyear &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;= &lt;/STRONG&gt;&lt;SPAN style="color:hsl(30, 75%, 60%);"&gt;&lt;STRONG&gt;$(minyear)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt; to &lt;/STRONG&gt;&lt;SPAN style="color:hsl(30, 75%, 60%);"&gt;&lt;STRONG&gt;$(maxyear)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;SPAN style="color:hsl(210, 75%, 60%);"&gt;&lt;STRONG&gt;step &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;SPAN style="color:hsl(210, 75%, 60%);"&gt;&lt;STRONG&gt;Let &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color:hsl(30, 75%, 60%);"&gt;&lt;STRONG&gt;toYear &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;= $(vyear) + &lt;/STRONG&gt;&lt;SPAN style="color:hsl(210, 75%, 60%);"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;SPAN style="color:hsl(210, 75%, 60%);"&gt;&lt;STRONG&gt;Trace &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;Store data from: $(vyear) to $(toYear);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;SPAN style="color:hsl(270, 75%, 60%);"&gt;&lt;STRONG&gt;Data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;:&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;SPAN style="color:hsl(210, 75%, 60%);"&gt;&lt;STRONG&gt;LOAD&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;SPAN style="color:hsl(30, 75%, 60%);"&gt;&lt;STRONG&gt;Year&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;SPAN style="color:hsl(30, 75%, 60%);"&gt;&lt;STRONG&gt;Value&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;SPAN style="color:hsl(210, 75%, 60%);"&gt;&lt;STRONG&gt;FROM &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;[lib://Save QVD/ENTIRE.qvd]&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;(qvd)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;SPAN style="color:hsl(210, 75%, 60%);"&gt;&lt;STRONG&gt;where &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color:hsl(30, 75%, 60%);"&gt;&lt;STRONG&gt;Year &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&amp;gt;= &lt;/STRONG&gt;&lt;SPAN style="color:hsl(30, 75%, 60%);"&gt;&lt;STRONG&gt;$(vyear)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;SPAN style="color:hsl(210, 75%, 60%);"&gt;&lt;STRONG&gt;and &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color:hsl(30, 75%, 60%);"&gt;&lt;STRONG&gt;Year &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&amp;lt;= &lt;/STRONG&gt;&lt;SPAN style="color:hsl(30, 75%, 60%);"&gt;&lt;STRONG&gt;$(toYear)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;SPAN style="color:hsl(210, 75%, 60%);"&gt;&lt;STRONG&gt;Store&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;SPAN style="color:hsl(270, 75%, 60%);"&gt;&lt;STRONG&gt;Data &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color:hsl(210, 75%, 60%);"&gt;&lt;STRONG&gt;into &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;[lib://Export/DATA_$(vyear)_to_$(toYear).qvd](&lt;/STRONG&gt;&lt;SPAN style="color:hsl(210, 75%, 60%);"&gt;&lt;STRONG&gt;qvd&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp;&lt;/STRONG&gt;&lt;SPAN style="color:hsl(210, 75%, 60%);"&gt;&lt;STRONG&gt;drop table &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color:hsl(270, 75%, 60%);"&gt;&lt;STRONG&gt;Data&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color:hsl(210, 75%, 60%);"&gt;&lt;STRONG&gt;Next&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see, this script is going every 3 years by using the "step" within the statement and now you just need to create within the loop a new variable that will calculate the end year. So if you start on 2000 the variable will count +2 making the end year be "2002". This will allow you to select years 2000, 2001 and 2002. After that the step will update the vyear variable by 3. So the next 3 years will be 2003, 2004 and 2005 etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the output that I get:&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://lithium-response-prod.s3.us-west-2.amazonaws.com/qlik.response.lithium.com/RESPONSEIMAGE/0b54f70a-8cac-432d-9edc-c9fd34bfa366.default.PNG" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 14:49:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-split-a-huge-qvd-file-into-multiple-qvds/m-p/1929314#M76511</guid>
      <dc:creator>Andrei_Cusnir</dc:creator>
      <dc:date>2022-05-11T14:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to split a huge qvd file into multiple qvds</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-split-a-huge-qvd-file-into-multiple-qvds/m-p/1929385#M76518</link>
      <description>&lt;P&gt;That solution is wonderfull, thank you very much!&lt;/P&gt;</description>
      <pubDate>Wed, 11 May 2022 17:00:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-split-a-huge-qvd-file-into-multiple-qvds/m-p/1929385#M76518</guid>
      <dc:creator>FranciscoQ</dc:creator>
      <dc:date>2022-05-11T17:00:13Z</dc:date>
    </item>
  </channel>
</rss>

