<?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 Update Old qvd's with data in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Update-Old-qvd-s-with-data/m-p/1619464#M445649</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;I have an application which loads 94 qvd files&amp;nbsp; and we keep getting new columns added into our qvd . In current code ,all columns existing&amp;nbsp; in the qvd from the beginning are assigned a name and set to a variable called Fields. for the new columns that come up ,first&amp;nbsp; the header is loaded and then a check is made to see if the column exists in a particular qvd. If not then its updated with 'NA' values and these new fields are then added to the table. Now the problem is that the no. of new columns are increasing day by day and the number of checks for the new columns are slowing down the app. How can i improve this code to make the application work faster.&lt;/P&gt;&lt;P&gt;LET vExtractCount=0;&lt;BR /&gt;LET vMaxFileCount=94;&lt;BR /&gt;LET vFileName = '';&lt;BR /&gt;LET vCurrentDate = Today();&lt;BR /&gt;LET v2MonthCutOff = AddMonths(today(),-2);&lt;BR /&gt;LET v6MonthCutOff = AddMonths(today(),-6);&lt;BR /&gt;LET v2YearCutOff = AddMonths(today(),-24);&lt;BR /&gt;LET vSubFolder = 'QVD_Folder\';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Do while vExtractCount &amp;lt; vMaxFileCount&lt;BR /&gt;// Extract for current Date&lt;BR /&gt;let vFileName = 'BTR_'&amp;amp;Date#(vCurrentDate,'YYYY-MM-DD')&amp;amp;'.qvd';&lt;BR /&gt;IF len(FileSize(vFilePath &amp;amp;vSubFolder &amp;amp;vFileName)) &amp;gt; 0 THEN&lt;BR /&gt;&lt;BR /&gt;// setting initially with always included variables&lt;BR /&gt;&lt;BR /&gt;SET fields =&lt;BR /&gt;"COL_A as [A],&lt;BR /&gt;COL_B as [B],&lt;BR /&gt;COL_C as [C],&lt;BR /&gt;COL_D as [D],&lt;BR /&gt;COL_E as [E],&lt;BR /&gt;";&lt;/P&gt;&lt;P&gt;// Load only the header row&lt;BR /&gt;COLS:&lt;BR /&gt;FIRST 1 LOAD *&lt;BR /&gt;FROM $(vFilePath)\$(vSubFolder)\$(vFileName) (QVD);&lt;BR /&gt;&lt;BR /&gt;//Check if the column exists in the temp table 'COLS'&lt;BR /&gt;IF (FieldNumber('COL_X','COLS')&amp;gt;0) THEN&lt;BR /&gt;SET fields = $(fields),[COL_X] as [X] ;&lt;BR /&gt;ELSE&lt;BR /&gt;SET fields = $(fields),'N/A' as [X];&lt;BR /&gt;END IF;&lt;BR /&gt;&lt;BR /&gt;IF (FieldNumber('COL_Y','COLS')&amp;gt;0) THEN&lt;BR /&gt;SET fields = $(fields),[COL_Y] as [Y] ;&lt;BR /&gt;ELSE&lt;BR /&gt;SET fields = $(fields),'N/A' as [Y];&lt;BR /&gt;END IF;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;DROP TABLE COLSIN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//Load the fields&lt;BR /&gt;Table1:&lt;BR /&gt;Concatenate(Table1)&lt;BR /&gt;LOAD&lt;BR /&gt;$(fields)&lt;BR /&gt;From $(vFilePath)\$(vSubFolder)\$(vFileName) (QVD);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;//Update the count&lt;BR /&gt;let vExtractCount = vExtractCount + 1 ;&lt;BR /&gt;&lt;BR /&gt;endif;&lt;/P&gt;&lt;P&gt;//Swich to the next QVD&lt;BR /&gt;if vCurrentDate &amp;gt; v2MonthCutOff THEN&lt;BR /&gt;LET vCurrentDate = Date(vCurrentDate-1);&lt;BR /&gt;elseif vCurrentDate &amp;gt; v6MonthCutOff THEN&lt;BR /&gt;LET vCurrentDate = Date(vCurrentDate-7);&lt;BR /&gt;elseif vCurrentDate &amp;gt; v2YearCutOff THEN&lt;BR /&gt;LET vCurrentDate = AddMonths(vCurrentDate,-1);&lt;BR /&gt;else&lt;BR /&gt;LET vExtractCount = 1000;&lt;BR /&gt;endif;&lt;BR /&gt;&lt;BR /&gt;LOOP;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 02:35:03 GMT</pubDate>
    <dc:creator>Prajna</dc:creator>
    <dc:date>2024-11-16T02:35:03Z</dc:date>
    <item>
      <title>Update Old qvd's with data</title>
      <link>https://community.qlik.com/t5/QlikView/Update-Old-qvd-s-with-data/m-p/1619464#M445649</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;I have an application which loads 94 qvd files&amp;nbsp; and we keep getting new columns added into our qvd . In current code ,all columns existing&amp;nbsp; in the qvd from the beginning are assigned a name and set to a variable called Fields. for the new columns that come up ,first&amp;nbsp; the header is loaded and then a check is made to see if the column exists in a particular qvd. If not then its updated with 'NA' values and these new fields are then added to the table. Now the problem is that the no. of new columns are increasing day by day and the number of checks for the new columns are slowing down the app. How can i improve this code to make the application work faster.&lt;/P&gt;&lt;P&gt;LET vExtractCount=0;&lt;BR /&gt;LET vMaxFileCount=94;&lt;BR /&gt;LET vFileName = '';&lt;BR /&gt;LET vCurrentDate = Today();&lt;BR /&gt;LET v2MonthCutOff = AddMonths(today(),-2);&lt;BR /&gt;LET v6MonthCutOff = AddMonths(today(),-6);&lt;BR /&gt;LET v2YearCutOff = AddMonths(today(),-24);&lt;BR /&gt;LET vSubFolder = 'QVD_Folder\';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Do while vExtractCount &amp;lt; vMaxFileCount&lt;BR /&gt;// Extract for current Date&lt;BR /&gt;let vFileName = 'BTR_'&amp;amp;Date#(vCurrentDate,'YYYY-MM-DD')&amp;amp;'.qvd';&lt;BR /&gt;IF len(FileSize(vFilePath &amp;amp;vSubFolder &amp;amp;vFileName)) &amp;gt; 0 THEN&lt;BR /&gt;&lt;BR /&gt;// setting initially with always included variables&lt;BR /&gt;&lt;BR /&gt;SET fields =&lt;BR /&gt;"COL_A as [A],&lt;BR /&gt;COL_B as [B],&lt;BR /&gt;COL_C as [C],&lt;BR /&gt;COL_D as [D],&lt;BR /&gt;COL_E as [E],&lt;BR /&gt;";&lt;/P&gt;&lt;P&gt;// Load only the header row&lt;BR /&gt;COLS:&lt;BR /&gt;FIRST 1 LOAD *&lt;BR /&gt;FROM $(vFilePath)\$(vSubFolder)\$(vFileName) (QVD);&lt;BR /&gt;&lt;BR /&gt;//Check if the column exists in the temp table 'COLS'&lt;BR /&gt;IF (FieldNumber('COL_X','COLS')&amp;gt;0) THEN&lt;BR /&gt;SET fields = $(fields),[COL_X] as [X] ;&lt;BR /&gt;ELSE&lt;BR /&gt;SET fields = $(fields),'N/A' as [X];&lt;BR /&gt;END IF;&lt;BR /&gt;&lt;BR /&gt;IF (FieldNumber('COL_Y','COLS')&amp;gt;0) THEN&lt;BR /&gt;SET fields = $(fields),[COL_Y] as [Y] ;&lt;BR /&gt;ELSE&lt;BR /&gt;SET fields = $(fields),'N/A' as [Y];&lt;BR /&gt;END IF;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;DROP TABLE COLSIN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//Load the fields&lt;BR /&gt;Table1:&lt;BR /&gt;Concatenate(Table1)&lt;BR /&gt;LOAD&lt;BR /&gt;$(fields)&lt;BR /&gt;From $(vFilePath)\$(vSubFolder)\$(vFileName) (QVD);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;//Update the count&lt;BR /&gt;let vExtractCount = vExtractCount + 1 ;&lt;BR /&gt;&lt;BR /&gt;endif;&lt;/P&gt;&lt;P&gt;//Swich to the next QVD&lt;BR /&gt;if vCurrentDate &amp;gt; v2MonthCutOff THEN&lt;BR /&gt;LET vCurrentDate = Date(vCurrentDate-1);&lt;BR /&gt;elseif vCurrentDate &amp;gt; v6MonthCutOff THEN&lt;BR /&gt;LET vCurrentDate = Date(vCurrentDate-7);&lt;BR /&gt;elseif vCurrentDate &amp;gt; v2YearCutOff THEN&lt;BR /&gt;LET vCurrentDate = AddMonths(vCurrentDate,-1);&lt;BR /&gt;else&lt;BR /&gt;LET vExtractCount = 1000;&lt;BR /&gt;endif;&lt;BR /&gt;&lt;BR /&gt;LOOP;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 02:35:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Update-Old-qvd-s-with-data/m-p/1619464#M445649</guid>
      <dc:creator>Prajna</dc:creator>
      <dc:date>2024-11-16T02:35:03Z</dc:date>
    </item>
    <item>
      <title>Re: Update Old qvd's with data</title>
      <link>https://community.qlik.com/t5/QlikView/Update-Old-qvd-s-with-data/m-p/1619571#M445662</link>
      <description>&lt;P&gt;Without deep diving into your code, but based on your description, I don't see any "easy" way to dramatically improve performance here.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I understood right, you cannot just CONCATENATE QVDs since you need that "NA" value for the field which will not exist into older files and you cannot join to previous QVDs and reduce the number of QVDs since you don't know if or when new fields will be coming.&lt;/P&gt;
&lt;P&gt;I would suggest, though, why the number of columns in such QVDs &lt;EM&gt;must&lt;/EM&gt; increase versus why the new data cannot have a value to be linked in the data model with older QVDs.&lt;/P&gt;
&lt;P&gt;Additionally, I would suggest loading an empty table including the new field names and concatenating this with older fields, and storing this new table into a new QVD, so the number of checks tomorrow will be the same or very similar, i.e.: you are not increasing one field every day, since the previous day has already all previous fields added.&lt;/P&gt;
&lt;P&gt;If you really need that "NA" you could reload that new QVD with both new and old fields and check the length of every field and assign 'NA' If(Len(Field) = 0).&lt;/P&gt;
&lt;P&gt;Even if the script took the same time to execute, making any table bigger means more values, more resource consumption and higher footprint, which you cannot avoid, and probably, over time, longer response times and poorer user experience.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2019 12:41:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Update-Old-qvd-s-with-data/m-p/1619571#M445662</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2019-09-03T12:41:59Z</dc:date>
    </item>
  </channel>
</rss>

