QlikView Error Message – “Error: Error in expression: PEEK is not a valid function”

Was thinking of having a separate category for QlikView error message for quite some time, fortunately it’s happening with this post.

“Error: Error in expression: PEEK is not a valid function”

Cause: 

Used Set statement for storing the result of peek expression in Script.

Set vVar = peek();

Solution:

Replace Set with Let.

Otherwise go as below,

Let vTemp=peek(..);

Set vVar=$(vTemp);

And also consider what if peek expression returns null value. That variable itself will not be available.

But still $(vVar) will return null and $(#=vVar) will return zero.