How to store and recover variables

    The example file shows how to fetch existing variables in a QVW file, and how to restore them back.

     

    The storage of current variables can be done form a QlikView Project (PRJ) folder or directly from a QVW file.

     

    The variables are store with their calculated values, not with the actual definition. To stored variable definition the variable has to be defined as a text. This can be done by using the SET definition.

     

    Variables defined with SET can be later evaluated by dollar expanding the variable. In the "Store and recover variables - QVW file.qvw" a variable gets the text now(), so the variable will not have the actual timestamp of reload.

     

    SET vNow = now()

     

    The now() will be evaluated as soon as it is dollar expanded into a expression

    context. See applicaiton text object for example.

     

    =$(vNow)

     

    So in summary, to make the variable definitions truly exportable, you might need to alter your variable definition strategy.

     

    EDIT: The sample was updated to include also Rob's suggestion from comments below.