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: 
jakobjosef
Creator II
Creator II

Errors in expression due to variables

Hi dear QlikView-Community,

I have a question concerning the use of variables in expressions.

I created a variable and let it be calcualted in an expression, like $(Variable).

Everything works fine, but the only thing is that QV writes "Errors in expression". Should i be disturbed by that or can i keep on going? Beside of that note there are no problems at all, the calculation works fine.

Thanks for your help

Jakob

7 Replies
andrey_krylov
Specialist
Specialist

Hi, Jacob. If you meen red underline then you can keep on going.

Anonymous
Not applicable

Hi

You can use variables in expression if there is red symbol inspite of it you can continue

you will get your expected results.

Thanks

jakobjosef
Creator II
Creator II
Author

Hi,

it looks like this, without red underlines or red symbols - but even though there is this note, the calculation works, so if you say I can keep on going im happy .

Capture.PNG

So thank you very much for your help!

Jakob

andrey_krylov
Specialist
Specialist

Yes, Jakob. It looks some different but I think it's the same I mentioned.

manoj217
Creator III
Creator III

If it is working fine leave those red lines.if there is an error in the expression it will shows error else just leave

Peter_Cammaert
Partner - Champion III
Partner - Champion III

If you want to know the reason why this is happening (and why everyone else seems to know that this Error message and red-wiggly-line-stuff won't cause any problems ;-), consider this:

The expression editor (and the script editor as well) has a syntax checker that tries to figure out what your expression means and whether it complies to the general expression ruleset. It manages to detect all common spelling errors, function call irregularities, missing or extraneous commas and other common mistakes. It even relies on a sort of limited context to detect non-existent fields and variables.

What it doesn't do however, is actually evaluate/execute your expression, and that causes some problems because $-sign expansions only result in expression parts when they are actually expanded at run-time/evaluation-time. Only at that particular time do they need to carry a useful value. In other words, neither the expression syntax checker, nor the script syntax checker expand variables in $-sign constructs. So while it knows that a variable name should be present in its internal list of defined variables, it cannot make anything of the $-sign construct until the expression is actually used to calculate results.

Ok, you may ask yourself "but why doesn't the syntax checker at least try to evaluate my expression and check the resulting expansion at the same time"? Well, the variable does exist, but it may still be empty at the time of editing your expression. Maybe because the variable is only set at script execution time. And that is only a simple exception that can't be avoided.

Conclusion: we ignore this anomaly, because every attempt by Qlik to fix this would probably make things worse. And probably also a lot slower...

[Edit] Sorry, I seem to ignore even my own english-language syntax checker... corrected the obvious spelling mistakes. 😛

jakobjosef
Creator II
Creator II
Author

Thank you so much for your comprehensive explaination! Good to know.

Jakob