Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
rdsuperlike
Creator
Creator

Variables

  1. What’s the difference between the following expressions: vVariable, $(vVariable) and $(=vVariable) ? Which one to use when?
4 Replies
ToniKautto
Employee
Employee

Exam question? Have you looked in the manual or search in the community?

The concept of using $() is called dollar-sign expansion, so look int he manual for the section that describes the feature.

What example have you tried, and where did you get stuck?

engishfaque
Specialist III
Specialist III

Dear Rdsuperlike,

Dollar-Sign Expansion:

We use $(vVariable) for text replacement in script or in expression.

Dollar-Sign Expansion with an Expression:

We use $(=expression), this way 1st expression will execute.

Ref: QlikView Reference Manual, Page. 293 & 294.

Kind regards,

Ishfaque Ahmed

Siva_Sankar
Master II
Master II

Hi,

For deeper understanding the difference check out this blog https://community.qlik.com/blogs/qlikviewdesignblog/2013/11/04/the-magic-of-variables . Find the attached application for the difference between variables with and without '=' sign.

Siva_Sankar
Master II
Master II

Enclosing the expression in parentheses

As we want to make sure that the expression always gets calculated in the right order, we enclose it in parentheses. Imagine, for example, we had an expression vExample containing 10 + 5 without parentheses. If we were to use that variable in an expression containing a fraction, for example, $(vExample) / 5, the wrong result would be returned (11 instead of 3).

Not prefixing the variable expression with an equals sign:

When the expression in a variable definition is prefixed with an equals sign (=), the variable gets calculated globally. In our example this would mean that the Load Factor % value is calculated once for the entire data model. When used in a chart, all dimensions would be ignored and the expression would just return the same global value for each dimension. As we obviously do not want this to happen, in this example we do not prefix our expression with an equals sign.

Dollar Sign Expansion:

Enclosing a variable (or an expression) between a dollar sign and parentheses (Dollar Sign Expansion), it tells QlikView to interpret the contents, instead of just displaying the contents. For example, $(=1 + 1) will not return the static text 1 + 1, but will return 2.