Variables

    Variables are really useful for a lot of things because you could store many different things within them and this could be changed while runtime or on user-action. Therefore they will be called variables.

     

    QlikView is here no exception and the use of variables is quite common. Very known examples are the format-code variables which will be automatically created on the first script-tab like: SET DateFormat='DD.MM.YYYY';


    Format Variable Tweaks

     

    And there are many more inbuilt variables like the system-variables or error-variables which are very helpful.

     

    There are different ways how to create variables and you need to know which syntax to apply for which kind of content and how you could access them again. It's easier as you think if you read the following links carefully:

     

    The Magic of Variables

    The Magic of Dollar Expansions

    Q-Tip #6 - Those Tricky $-Sign Expansions | Natural Synergies

    The Little Equals Sign

     

    Especially the possibility to create user-defined functions with variables is very useful:

     

    Variable That Acts Like a User-Defined Function.

    Dynamic Field Expressions with Variables

    Variables with Parameters

     

    To document things is in general recommended as well as by variables but be careful:

    Well-commented variables. Be careful!

     

    A special kind of variables are include-variables which could contain any kind of script-parts:

    The $(Include) which you $(Must_Include) into your toolkit

     

    And of course you could use the same variables not only in one application if you used a centralized approach to keep variables outside from QlikView:

     

    Central KPI Formula Repository (solution)

    Storing variables outside of QlikView

    Loading Variables Via Loadscript

    Managing Variables

    Re: Setting a variable in script...

    How to store and recover variables

    Create Colour Variables from an Excel Workbook

     

    But not all variables which you creates do you need forever therefore to delete unneeded variables is an important task and has its difficulties and of course there are several ways of doing it: Deleting variables

     

    Another topic is to transfer variables from one application to another:

     

    Macro to Copy Variables In From Another Document

    More on Copy Variables From One Document to Another

     

    Helpful might also be to read respectively to analyse your variables:

    Recursively resolve $(variables) to get readable sourcecode


    There is some content-overlapping within the above used links but I think the complement to each other is useful and of course you will find many more interesting postings here within the qlik community to these topic - the notes here are a good starting point to go further.

     

    Have fun!

     

    Marcus Sommer