Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am having some trouble understanding the dollar sign expansion.
5
//test
The comment in the last line is intended and part of my confusion.
Expression: $(vTest)
Result: 5
Internal: I guess that QS expands this to the following and evaluates the complete expression afterwards:
5
//test
Expression: $(vTest) / 2
Result: 5
Internal: I guess that QS expands this to the following and evaluates the complete expression afterwards:
5
//test / 2
Expression:
$(vTest)
/ 2
Result: 2.5
Internal: I guess that QS expands this to the following and evaluates the complete expression afterwards:
5
//test
/ 2
Expression: $(=vTest) / 2
Result: 5
Internal: I have no idea what happens here internally. According to the Qlik documentation the equal sign should cause Qlik to pre-evaluate the variable and use the result for the expression.
The expression will be evaluated and the value will be used in the expansion.
So what I would have expected is, that Qlik evaluates $(=vTest) to 5 and then divides it by 2, so the result should be 2.5 and not 5.
Do you have any explanation for what Qlik is doing in my Scenario 4?
Guess that's because after the dollar sign expansion, the expression evaluation kicks in, ignoring the comment the same way it will ignore a comment if you input the variable content directly as expression in the chart expression space.
While using =vTest, expanding the variable content including the comment is part of the expression evaluation.
I think you are paying the price for overusing the variable-feature. Only that it is in general possible to use for nearly everything variables and thats even technically possible to nest multiple variables doesn't mean that it's sensible to do it. Variables should simplify things and not result in the opposite. Just keep it simple.
- Marcus
Adding to your first remark in your last post:
I do work with QS also, but not today.
Just to make sure, have you read HICs blog posts about variable evaluation?
Like
Hi Stefan,
I read the The Little Equals Sign article several times in the past.
Additionally those two articles are great.
The Magic of Dollar Expansions
I would like to thank you for all the input so far and might get back to you after I have tested some more things to understand what is going on in detail.
Yes, all of Henric's posts are a must-read IMHO, these two blog posts are linked in the first post, so I've refrained from posting the links.
There is indeed a separate space for a description:
I never used this before .. probably I should in the future ..