Qlik Community

Ask a Question

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Qlik Users, make your voice heard! Participate in Wisdom of Crowds® Market Study: Start Survey
Showing results for 
Search instead for 
Did you mean: 
Contributor III
Contributor III

Copying variables between applications (in Sense)

I have variables created in an application.

I would like to clone them and use them in another application.

What are my alternatives?

Does defining them as Master items help vs creating them as Variables?

I've located this thread under QV Copying variables from an application to a second one

and this under QS Is there an input box in QlikSense?

So it would appear there is an answer in a multi-step process of getting an extension, installing it, creating an input box, moving my variables there, exporting to excel, importing back...  just seems like this should be so much simpler.

Any guidance would be appreciated.

Thank you in advance!

1 Reply

Hi Jon,

I would use an Excel file, where you can read the variables into many applications. Here is an example of mine:

In every QlikView application, we have expressions, labels, color definitions, variables, etc. Just thinking of the expressions, if we write them in QlikView, every time, we have to change the expressions, we have to change it within each chart.

By defining the expressions, labels and colors at one place outside the QlikView application, we are able to manage changes in much more convenient way and even reuse it within other applications. This might be important when using, corporate colors, slogans, titles, etc.

I have created an excel file with several sheets, named it GUI_PARAMS.xlsx and put it into the same directory where the QlikView application is. The first sheet contains the sheet names within the excel file, which will be read in to the application and we will call this sheet vSHEETS.

Bildschirmfoto 2017-02-04 um 08.35.23

Therefore, I have three sheets vCOLOR, vLABEL and vVARIABLES_CALC, which will be processed. I have created each of these sheets with the same names.

Bildschirmfoto 2017-02-04 um 08.38.07

Each of the sheets containing to columns (column name with the sheet name and the Entry column) containing the variable name and the value.

Bildschirmfoto 2017-02-04 um 08.39.34

In the script editor of the QlikView application, we can include this code below, which will read in the vSHEETS sheet and then based on the entries on this sheet, read out all other content of the sheets.

FROM [lib://Folder/GUI_Params.xlsx]
(ooxml, embedded labels, table is vSHEETS)where not isnull(vSHEET);

FOR I = 0 TO NoOfRows('PARAM_TMP') -1
LET $(vSHEET) = PEEK('Entry',$(I),'PARAM_TMP');

LOAD $($(vSHEET)) ,Entry
FROM [lib://Folder/GUI_Params.xlsx]
(ooxml, embedded labels, table is $($(vSHEET)));

FOR I_2 = 0 TO NoOfRows('$($(vSHEET))')
vSHEET_2 = PEEK('$($(vSHEET))',$(I_2),'$($(vSHEET))');
LET $(vSHEET_2) = PEEK('Entry',$(I_2),'$($(vSHEET))');



When you run the script, you will see the entries in the Variable Overview (under Settings).