Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Declare variables in Script editor window using set analysis

Hi,

Can someone guide me how to declare a variable using set analysis in script editor window with some conditions and also can you help me understand if this will have any impact on the performance of the application, if not , what would be ideal things to be done to enhance the performance of the application developed.

2 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Set Analysis is not used in Script. Set Analysis is only used in chart expressions.

Variables are defined in script using the SET or LET script statements. Defining the variables would not have performance impact.

-Rob

jaimeaguilar
Partner - Specialist II
Partner - Specialist II

Hi,

an option for this would be to have and XLS,CSV, etc file that contains the name of your variable, the definition and even some extra fields like description (for metadata purposes). Then in QlikView you can populate all your variables from this external file:

Variables:

LOAD Variable,

          Expression

FROM

[Variables.xlsx]

(ooxml, embedded labels, table is Sheet1);

Let vNumberOfRows = NoOfRows('Variables'); //the parameter here is the name of your table

For vI = 0 to (vNumberOfRows - 1)

  Let vVariable_Name = Peek('Variable',vI,'Variables'); //1. Field 2. Counter 3. Table

  Let [$(vVariable_Name)] = Peek('Expresión',vI,'Variables');

Next vI

With this sample code you can create all the variables you need from an external file. I think this is better to maintain your variables. If you use a XLS file for loading variables, you can enter your expressions adding a single quote at the begining, assuring that no matter how long your expression, it will fit in a single cell, and also your expression will be treated as a string within Excel.

This doesn't affect in any way the load in QlikView, in fact I think this a very good way of having a better control of your variables and also another tip is to work with 3-4 tiers of qvw. What I mean is to have an extraction level, a transformation level, a data model level and finally through a binary load create you final app. At this level you can put this code, so everytime you have to change something in your variables, you just have to reload the final app (because it has a binary load it would take just a few seconds to reload). Also this way you can separate the duties for developers and duties for designers/final users,

regards