Many a times we may want to have same variables in different Qlikview document. So, we can put all those variables in a spreadsheet can bring them in Qlikview document using a simple piece of script.
Similarly, sometimes we may want to have variables from one Qlikview document in other. Since there is no direct way to achieve this, there is a workaround. We can export the variables from the source Qlikview document to spreadsheet and then they can be brought into destination Qlikview document as mentioned above.
I have used 4 files to demonstrate this. There are two Qlikview documents and two spreadsheets.
Variables (Spreadsheet) - This file describes how should we store Variable information to bring back in Qlikview. There would be two columns First column is the name of variable and the second one is the valid Qlikview expression/Function.
Importing Variables (QV) - This file contains the script to bring variable name and their corresponding expression from spreadsheet and then creating the required variables.
Now, It's time to know how variables can be exported to spreadsheet, so that later they can be bring into other Qlikview document. Before we talk about it, Let's discuss why we are exporting variables from one document to spreadsheet and then using that spreadsheet to create variables in new Qlikview document, why we don't use the same spreadsheet which we used Initially to create variables.
The answer to this question is, of course we can use old spreadsheet again. We will get those variables created but if we want to have the values of those variable from Source Qlikview document we will not get those.
For ex: we will not get the same value for variables in new document,
So, If we want not only want to use same variable but also wish to use same value inside those variables then we have to use this export-import method.
Exporting Variables (QV) - This document will export the variables and the values stored in them to spreadsheet. For this to achieve it contains one Straight Chart with one dimension and expression. And a macro which exports the variable details from chart to spreadsheet(Export_Var).
Importing Variables (QV) - Now when we reload this Qlikview document, same variable will be created here but they will retain the values which they had in Exporting Variables Qlikview document.