Split Data YearWise QVDs

    //Yearly QVD:

    TempTable:
    LOAD Distinct Year(Date) AS Year
    FROM QVD\Main.qvd(qvd)
    Order by Year(Date) asc;

    NoConcatenate

    Table:
    Load Year,Min(Year) as minYear, max(Year) as maxYear
    Resident TempTable;

    Let vMin=Peek('minYear', 0, 'Table');
    Let vMax=Peek('maxYear', 0, 'Table');

    FOR i=$(vMin) to $(vMax)
    LET vYear = Peek('Year',$(i),'Table');

    YearWise:
    NoConcatenate
    LOAD * FROM QVD\Main.qvd(qvd)
    Where Year(Date) = '$(vYear)';

    STORE YearWise into TableName_$(vYear).qvd;
    DROP Table YearWise;

    Next

    DROP Table TempTable;
    DROP Table Table;