Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Variable expansion, quotes and equal sign

Hi,

I have figured how to do what I want, but I don't completely understand how it is working. If there's anyone out there who understands this, I would love for you to explain it to me and let me know if there is any other way to accomplish the same result.

sample_table1:

LOAD * INLINE [

  location

  siteA

  siteB

  siteC

  siteD

];

SET vTest2= =Concat(location, ', ');

Then in my report I have a table with dimension of ='$(vTest2)'

Which give the result of siteA, siteB, siteC, siteD (or whichever of these are selected)

(I need it to be a table dimension because in my real app, I need to display it as a URL, and my understanding is that only table dimensions can be clickable URLs)

Why do I need the equal sign in the table dimension? This blog post (The Little Equals Sign) says that data can be interpreted as expression or text, and the default varies for different objects.

  • If the table dimension is looking for an expression, we do we need the equal sign? Why doesn't '$(vTest2)' work?
  • If the table dimension is looking for text, why do we need the equal sign and quotes? Shouldn't the equal sign in the variable itself be sufficient to trigger the calculation? Why doesn't $(vTest2) work?

Thanks,

Tanya

Labels (1)
6 Replies
NZFei
Partner - Specialist
Partner - Specialist

I have no idea about why. I've seen a lot of strange thing in Sense...

In the official help page, it just says so:

Creating a calculated dimension ‒ Qlik Sense

shraddha_g
Partner - Master III
Partner - Master III

What is the qliksense version you are using?

Anonymous
Not applicable
Author

Version 2.2

Is the behaviour different in more recent versions?

Anonymous
Not applicable
Author

Ok, so I'm making progress. I think I understand this much (there is a follow-up question below):

In the dimension definition: ='$(vTest2)'

  • The equal sign tells Qlik that it's an expression to be evaluation, not just text.
  • The single quotes tell Qlik to treat what's inside as a literal string, not a field name.

Then for the variable: SET vTest2= =Concat(location, ', ');

  • The scope of the equals sign does not carry into variables. Qlik assumes anything within $() is just text.
  • To get Qlik to evaluate the expression, we need to add the equal sign within the variable.

=====================================

FOLLOW-UP QUESTION

How can I make this work without any variable or dollar-sign expansion? I've tried defining my dimension as:

  • ='Concat(location, ', ')'
  • ='=Concat(location, ', ')'

But neither of those work.

I can do it without the variable by defining the dimension like this: ='$(=Concat(location, ', '))', but why do I need dollar-sign expansion if I have no variable?

Thanks!

Tanya

NZFei
Partner - Specialist
Partner - Specialist

Maybe some Qlik expert can help you with "why" but as a first line developer, I will define a variable in the front (not script) like this:

and then use it to the dimension:

Fei

Anonymous
Not applicable
Author

Oh - isn't that interesting! I thought I always needed dollar-sign expansion when using a variable. This syntax is so confusing!