Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator III
Creator III

QlikView Expression

Guys,

Assume instead of using expressions in charts directly (in run time), I store expressions in the script using SET or LET function in a variable while loading.

Now could you tell me which method will take loading issues in the front end from below points,

1. Writing expressions in the charts directly - first data will be fetched into the model and then the expression will be processed.

2. Store those expressions in the script using SET or LET functions - Expressions are processed and will be stored in memory.

please say which method is preferable and also please intimate whether above mentioned 2 points are correct.

6 Replies
Partner
Partner

HI Siva,

Point one is correct you should write expression at fronted . If you have some calculations then you can write on script level.

At fronted you can easily change expression but backed you need to reload so i will suggest in fronted(charts).

Thanks,

Arvind Patil

Highlighted
Creator III
Creator III

Thanks for your reply, Arvind. I have very complex expression for 3 or more charts. If I go with point 1 as you suggested, the expression will be processed in the run time.

If I store those expressions as dimensions or variables as a measure, will it be more easily load the the expected data, right?

Highlighted
MVP
MVP

Hi Siva,

Either you write the expressions in chart or you store it in variable using SET or LET, it will take the same time to calculate the expression. Your front end expression evaluates every time when you make any selection.

see this to better understand  see the below

The Calculation Engine

Highlighted
Creator III
Creator III

Thanks for your suggestion Kushal.

Highlighted
MVP
MVP

Adding the expression in variable using SET or LET will make the expression reusable and easy to maintain.

Highlighted

Simplifying, in QlikView, all data from the different sources, either those be QVD files, spreadsheets, CSV, database tables, whatever, is loaded into memory as the first step, before any calculation could happen.

So regardless where do you actually write the expression, performance and memory use will be very similar.


To name a few key advantages to have expressions in an external file or in the script:

  • Maintenance: all your expressions are in one single place, easier to back up and trace. Thinking of the Qlik Deployment Framework, this seems quite convenient
  • Reusability: if using an external file, any other developer using the same data model but for different purposes can use the same expressions
  • Central point of truth: anybody can validate that your expression is correct

However there are also important disadvantages:

  • Agility: you have to reload to make any change to the expression. This could work in a productive environment where very few changes happen, but it's a waste of time during development phase. (You could modify the content in the Variable Overview, but you will have to anyway move the change to the script and reload at some point).
  • Complexity: often, expression contain characters like single quotes, double quotes, greater than, etc. and directly assigning these to a variable would imply the use of external files or string conversions during the script e.g.: replace "@" by "single quote" or using Chr() functions

The variables will be expanded (processed) always in run time, except in one case, when the first character in the value of the variable is the "=" sign. In this case, the value is indeed evaluated with every click and represented wherever the variable is expanded. So the variable does not need to be called to be calculated.

It will come to your very personal way of development where to keep the variables: in the script, external files or directly on your charts. This will also will vary widely depending on the customer and the nature of the development, e.g.: when you need to reload every time to reflect a change in the variable, you spend a lot of time, if you work alone you could store everything on the expressions, if you work in a team you would need to share this, if the customer has very strong ITIL requirements, it will likely require you to save expressions somewhere else. If you abuse global variables ("=" as the first character in the value), performance can be severely affected.

In my case, very seldom use the script for expressions, but sometimes I have to use an external file so others can use the same syntax.