Generic Script for QVD Generator

    Hi All, In the Qlikview Development, QVD creation is the very common and we create the QVD Generators qvw files for this tasks.

    So, In this document I will give briefly about the Generic script for all QVD Generators. This script used across the multiple QVD generators files with other DB connection and List of tables needs to be in QVD's .

     

    Please find the below script:

     

    //DB Conncetion

    SET ThousandSep=',';

    SET DecimalSep='.';

    SET MoneyThousandSep=',';

    SET MoneyDecimalSep='.';

    SET MoneyFormat='$#,##0.00;($#,##0.00)';

    SET TimeFormat='h:mm:ss TT';

    SET DateFormat='M/D/YYYY';

    SET TimestampFormat='M/D/YYYY h:mm:ss[.fff] TT';

    SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';

    SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';

     

    // #### DB COnnection #### This will be change if we have more DB's

    ODBC CONNECT ... ;

     

     

    // ##### QVD Path ####### This will be change if we want to change the QVD folder path

    SET vQVDPath = 'qvdata' ;

     

     

    // List of Tables, Here I am creating with InLine. You can Use txt file or excel file. This will be change

    LIST_OF_TABLES:

    LOAD * INLINE [

    TABLENAME

    SCHEMA.TABLE1

    SCHEMA.TABLE2

    ] ;

    // From This line, the script is static

    // Generate the Loop for each value in the LIST_OF_TABLES table

     

    FOR i=1 to FieldValueCount('TABLENAME')

    LET vTableName = FieldValue('TABLENAME',$(i)) ;

     

    $(vTableName):

    SELECT * FROM $(vTableName) ;

     

    STORE $(vTableName) into [$(vQVDPath)\$(vTableName).qvd] (qvd);

     

    //QVD DETAILS info

    QVDDETAILS:

    LOAD '$(vTableName).qvd' AS QVD_NAME ,

           '$(vTableName)' AS SOURCE_TABLENAME,

           NoOfRows('$(vTableName)') AS NO_OF_ROWS

    AutoGenerate 1 ;

     

    DROP Table $(vTableName) ;

     

    NEXT i

     

    In the above script, just change the DB connection , QVD Path and List of Tables for the another QVD Generator qvw file.