Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
adamgaox
Creator
Creator

Dollar sign expansion with variable issue with & operator in expression

Dear All,

I have an issue with dollar sign expansion with my variable;

I have set my variable2 as =MaxString(MTH) & 'Q'

When I use the variable2 in expression

=$(Variable2)  in textbox

it will return Garbage after expression 'Q'

but if I write ='$(Variable2)' it will work and show the correct value.

Could anybody explain me the reason?

I have attached my qvw file.

 

Thanks in advance.

Labels (1)
1 Solution

Accepted Solutions
jaibau1993
Partner - Creator III
Partner - Creator III

Hi!

When you usea a variable with dollar expanssion there are several steps that you have to take into account:

  1. The variable is evaluated (if the variable definition starts with '='). Thus, the expresion =MaxString(MTH) & 'Q'  is evaluated. Let's suppose that the evaluation gives JaimeQ (where Jaime is MaxString(MTH))
  2. Expansion: the $(whatever) is substituted by its content. In this case, $(Variable2) is substituted by JaimeQ .
  3. Evaluation: the result of the expanssion is evaluated so QlikView is trying to interpret the expression "=JaimeQ" and it is, obviously, wrong.

Summarizing, when you write in a text box

=$(Variable2)

It is equivalent to

=JaimeQ

WRONG! On the other hand, when you write

='$(Variable2)'

it is equivalent to

='JaimeQ'

CORRECT! 

I hope I've explained myself!

Regards,

Jaime.

View solution in original post

3 Replies
anushree1
Specialist II
Specialist II

Its because qlikview needs to undestand that the value passed is a string so the quotes help in providing that information, hope that helps

jaibau1993
Partner - Creator III
Partner - Creator III

Hi!

When you usea a variable with dollar expanssion there are several steps that you have to take into account:

  1. The variable is evaluated (if the variable definition starts with '='). Thus, the expresion =MaxString(MTH) & 'Q'  is evaluated. Let's suppose that the evaluation gives JaimeQ (where Jaime is MaxString(MTH))
  2. Expansion: the $(whatever) is substituted by its content. In this case, $(Variable2) is substituted by JaimeQ .
  3. Evaluation: the result of the expanssion is evaluated so QlikView is trying to interpret the expression "=JaimeQ" and it is, obviously, wrong.

Summarizing, when you write in a text box

=$(Variable2)

It is equivalent to

=JaimeQ

WRONG! On the other hand, when you write

='$(Variable2)'

it is equivalent to

='JaimeQ'

CORRECT! 

I hope I've explained myself!

Regards,

Jaime.

adamgaox
Creator
Creator
Author

Thanks a ton.