Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikviewforum
Creator II
Creator II

Splitting the Yearly QVD in to Monthly QVD

Hi All,
How to read the data from the Single QVD which contains all the data and split into monthly QVD. Please help...

Regards,
qvforum

1 Reply
marcus_malinow
Partner - Specialist III
Partner - Specialist III

Hi qvforum,

here's an example script which chould help

YearMonthsFound:
NOCONCATENATE
LOAD concat(distinct YearMonthFound, ',') as YearMonthsFound;
LOAD Year & '-' & Month as YearMonthFound
RESIDENT WhateverTable;

LET vYearMonthsFound = peek('YearMonthsFound', -1);

DROP TABLE YearMonthsFound;

FOR EACH vYearMonthFound IN $(vYearMonthsFound)
      TRACE $(vYearMonthFound);

      WhateverTable_$(vYearMonthFound):
      NOCONCATENATE LOAD *
      RESIDENT WhateverTable
      WHERE Year = $(vYearMonthFound);

      IF vFullReload <> 1 THEN
          IF NOT ISNULL(QvdCreateTime('qvd\WhateverTable_$(vYearMonthFound).qvd')) THEN
               CONCATENATE (WhateverTable_$(vYearMonthFound))
               LOAD * FROM 'qvd\WhateverTable_$(vYearMonthFound).qvd' (qvd)
               WHERE NOT EXISTS (KeyField);
          ENDIF
      ENDIF

      STORE WhateverTable_$(vYearMonthFound) INTO 'qvd\WhateverTable_$(vYearMonthFound).qvd';

      DROP TABLE WhateverTable_$(vYearMonthFound);
NEXT vYearMonthFound