Qlikview Scripting Inheritance Concepts

    Generally, in the Programming languages we will create generic functions or object classes to reuse the existing code to avoid the maintenance and reduce no of line in the code. Technically it is called Inheritance.

     

    In the Qlikview, we need to write lot of scripting to load the data from different data sources. So can we Inherit the existing qlikview script code from one application to another ? The simple answer is Yes.

     

    By using below function and how we will implement the inheritance in the Qlikview scripting:

     

    1. Sub .. End Sub & Call

    2. Include

     

    From Help File:

     

    Sub .. End Sub & Call:

    The sub..end sub control statement defines a subroutine which can be called upon from a call statement.

    The syntax is:

    sub name [ ( paramlist )] statements end sub

    Where:

    name is the name of the subroutine.
    paramlist is a comma separated list of variable names for the formal parameters of the subroutine. These can be used as any variable inside the subroutine.
    statements is any group of one or more QlikView script statements.

     

    By using this keyword, we can create the user defined functions with block of Qlikview script statements and we can call this function by Call keyword.

     

    Include:

    $(Include =filename )

    The include variable specifies a file that contains text that should be included in the script. The entire script can thus be put in a file. A user-defined variable.

    Example:

    $(Include=abc.txt);

     

    The Include function work like 'Import' function in the programming language. So we can include the qlikview script code from some where else.

     

    Scenario: We are making Raw QVD's (same structure as DB table) from different DB sources. For each DB source we need to create the one qvw to make the QVD's. But I am going to create generic application to load the data from different data sources.

     

    Please find the attached zip file for solution.

     

    Note: The Include function didn't throw any error in the script file doesn't exist in the specified folder path. But the Must_Include function will throw an error if the script file does not exist.