<?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: Split dataset into seperate files based on month in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Split-dataset-into-seperate-files-based-on-month/m-p/1006236#M975548</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sensational, that fills the current need so I'll give this a go today and post back if I get issues.&amp;nbsp;&amp;nbsp; the If statement is obviously the key here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So an interim question - if the variable was larger, eg. today()-90 days and the new data passed over 3 (or more) months, - rather than using nested if statements - is there a way to create a script that looks within, pulls out all the various months in the data that have changed, and exports accordingly?&amp;nbsp;&amp;nbsp;&amp;nbsp; This would work no matter if the new data crossed 2 months or 12.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the end-state goal of my current project.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Aug 2015 23:38:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-08-27T23:38:38Z</dc:date>
    <item>
      <title>Split dataset into seperate files based on month</title>
      <link>https://community.qlik.com/t5/QlikView/Split-dataset-into-seperate-files-based-on-month/m-p/1006233#M975545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;H1&gt;&lt;/H1&gt;&lt;P&gt;Hey everyone, brand new to Qlikview and this is a bit tricky to explain so please bear with me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;So we have monthly QVD files eg.&amp;nbsp; 201506.qvd (June) ; 201507.qvd (July) ; 201508.qvd and so on containing data pulled from another system and turned into a QVD.&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Data example is&lt;/P&gt;&lt;TABLE style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TBODY style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;Date&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;Name&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;Sales&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;20150730&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;Frank&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;20150730&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;Bob&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;20150801&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;Bob&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="border: 0px; font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;20150801&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;Jenny&lt;/TD&gt;&lt;TD style="padding-right: 4px; padding-left: 4px; border: 0px; font-style: inherit; font-family: inherit;"&gt;9&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;The script brings all data from these files to compile a year's worth of data up to a moving variable date 7 days ago.&amp;nbsp; The script then brings in the most recent 7 days of data from the other system source, and appends it to the data from the QVDs.&amp;nbsp;&amp;nbsp;&amp;nbsp; So the QVDs will always be up to the current date, but every day we effectively scrap the last 6 days data and overwrite them with the new 7 day data pull.&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;This part is working and all good when I use a single QVD file, but I've no idea where to start with the next step. &lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;I need to then re-split out the data from this new table into monthly files, overwriting the files that exist.&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;In the most recent case, as we're looking back 7 days, it pulls in June to August's QVD data, appends the new, then :&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;201506.qvd would be overwritten with June data but identical&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px; font-family: inherit;"&gt;201507&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px; font-family: inherit;"&gt;.qvd&lt;/SPAN&gt; would be overwritten with July data but identical&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px; font-family: inherit;"&gt;201508&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px; font-family: inherit;"&gt;.qvd&lt;/SPAN&gt; would be overwritten with August data, however this file now contains 1 new day of data plus different data for the last 6 days.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;I need this to occur automatically.&amp;nbsp; The 7 day new data pull works off a Today()-7:Today() variable so there is ideally no manual input required.&amp;nbsp; The bigger issue is when the 7 days crosses months (eg 29/06 - 06/08) as in this case 2 files would need to be overwritten with new data.&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333330154419px; font-family: inherit;"&gt;I'm open to suggestions on best way as I don't really even know where to start.&amp;nbsp;&amp;nbsp;&amp;nbsp; If the best option is to only overwrite files where there are data changes then I'm fine with that. &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Let me know if any of that needs clarification.&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Thanks again,&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;&lt;/P&gt;&lt;P style="font-weight: inherit; font-style: inherit; font-family: inherit;"&gt;Dave&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 07:16:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Split-dataset-into-seperate-files-based-on-month/m-p/1006233#M975545</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-27T07:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: Split dataset into seperate files based on month</title>
      <link>https://community.qlik.com/t5/QlikView/Split-dataset-into-seperate-files-based-on-month/m-p/1006234#M975546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just a quick thought - did you try to change your variable calculation from Today()-7; Today(), to something more complex, that will include the month change check within that time and will allow you to keep the previous month file unchanged, my thought here would be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; month(Today() - 7)&amp;nbsp; = month(Today())&amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do Your Previous Calculation,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&amp;nbsp;&amp;nbsp;&amp;nbsp; -&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do your Previous calculation, but take dates monthstart(Today())&amp;nbsp; till Today() &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But you will have to give us some sample data in order to check the above idea - not sure at this point how your variable is being calculated etc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 09:19:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Split-dataset-into-seperate-files-based-on-month/m-p/1006234#M975546</guid>
      <dc:creator>kuczynska</dc:creator>
      <dc:date>2015-08-27T09:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: Split dataset into seperate files based on month</title>
      <link>https://community.qlik.com/t5/QlikView/Split-dataset-into-seperate-files-based-on-month/m-p/1006235#M975547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I trust this example code will help:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;//---- Set parameters and variables&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let vPath = ....;&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; // file path to qvd files&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let vToday = Num(Today()); // numeric&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let vBase = vToday - 7; // numeric&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let vMonthStart = Num(MonthStart(vToday));&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let vMonthEnd = Floor(MonthEnd(vBase));&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let vBaseName = Date(vBase, 'YYYYMM') &amp;amp; .'qvd';&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Let vTodayName = Date(vToday, 'YYYYMM') &amp;amp; .'qvd';&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;//---- Update prior month qvd if necessary ----&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;If Month(vBase) &amp;lt;&amp;gt; Month(vToday) Then&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; T1:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; LOAD *&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; FROM source&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Where tDate &amp;gt;= $(vBase) And tDate &amp;lt;= $(vMonthEnd);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Concatenate (T1)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; LOAD *&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; FROM [$(vPath)\$(vBaseName)] (qvd)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; Where tDate &amp;lt; $(vBase) ;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; STORE T1 into [$(vPath)\$(vBaseName)] (qvd);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp; DROP Table T1;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;End If&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;//---- Update current month qvd&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;T1:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD * &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FROM source&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Where tDate &amp;gt;= $(vMonthStart) And tDate &amp;lt;= $(vToday);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;STORE T1 into [$(vPath)\$(vTodayName)] (qvd);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;DROP Table T1;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;//--- Now load the data from qvd ----&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Main:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;LOAD *&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FROM [$(vPath)\*.qvd] (qvd);&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that your will need to change the Load * from source to the correct load from your source system and the references to tDate to a Date field in your source (not a date/time field!).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to apply some rules to the qvd's you load in the last step, change that From *.qvd to a For Each vFile in FileList('$(vPath)\*.qvd') loop, and parse the file name in vFile to determine if that file should be loaded.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 10:16:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Split-dataset-into-seperate-files-based-on-month/m-p/1006235#M975547</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2015-08-27T10:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: Split dataset into seperate files based on month</title>
      <link>https://community.qlik.com/t5/QlikView/Split-dataset-into-seperate-files-based-on-month/m-p/1006236#M975548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sensational, that fills the current need so I'll give this a go today and post back if I get issues.&amp;nbsp;&amp;nbsp; the If statement is obviously the key here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So an interim question - if the variable was larger, eg. today()-90 days and the new data passed over 3 (or more) months, - rather than using nested if statements - is there a way to create a script that looks within, pulls out all the various months in the data that have changed, and exports accordingly?&amp;nbsp;&amp;nbsp;&amp;nbsp; This would work no matter if the new data crossed 2 months or 12.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the end-state goal of my current project.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 23:38:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Split-dataset-into-seperate-files-based-on-month/m-p/1006236#M975548</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-27T23:38:38Z</dc:date>
    </item>
  </channel>
</rss>

