Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
JAN. 24, Q&A with Qlik: Making the Move to Qlik Cloud Reporting: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
sagarjagga
Creator
Creator

Logic behind variable expansion

Hi All,

I am little confuse with variables with and without expansion . Let me explain you with an example

Let X= 7;

Let Y = 7 +X; -----------2

Let Y = 7 + $(X);------------3

both 2 and 3 will return Y = 14. how just by adding X without expansion in Y is working fine as we are adding the variable in Y.

Even comprising without expansion also works that is

Let Z =(if Y= 14 ,1,0);

the above will return Z =1. But if want to load ID greater than Y then i have to use expansion of Y also Qlik will give me an error. For example

Load ID From.... where ID >= $(Y); ------this will work fine

Load ID From.... where ID >= Y; ------ this will give error, Y not Found.

 

Thank you in Advance

Labels (1)
2 Replies
andoryuu
Creator III
Creator III

In the context of a Let statement the parser knows you are refering to variables. This is why Let Y = 7 + X; works without expansion. In the context of load statements it will interpret Y without the expansion as a field name (i.e. if you had a field in your dataset that was called "Y" you'd want to reference that - not the variable). Expansion is the way of telling the parser to leave the contect it's currently in to evaluate the statement differently (in this case look for a variable name).
sagarjagga
Creator
Creator
Author

Thanks for your reply!!

Still i have doubt , then how variable comparison works in if statement even without expansion.