A very short tip on writing QlikView expressions that might save you a lot of headaches. In my last online training on Set Analysis (another one coming up this week) I showed a simple technique that I use when writing expressions in QlikView, especially when they contain nested functions. Based on the feedback, it seemed to resonate quite well with the attendees and not everybody was aware of this technique, so I thought I might share it with you as well.
It can simply be summarized as: Always Be Closing.
Whenever I write an expression that contains a parenthesis (or curly bracket/chevron/whatever) that also needs to be closed, I immediately close it and place the cursor one step back. Or, to show it visually (in slow mo):
This way, you’ll never need to think about how many parentheses/etc. you need to close your expression. Of course, this technique also works for Excel, SQL or any programming language.
As a follow-on tip, whenever I have to ‘decipher’ a nested expression within QlikView, I work inside-out. Start with the inner-most function, figure out what it does and what value(s) it returns, then move on to the function that uses the output of the first function, figure out what that does, and so on.
One comment
Very good tip, that I have learned to follow while working with QlikView over time!
I would also add the fact that spreading a comlpex nested if expression over on several lines and indenting right within the expression makes the expression MUCH easier to debug / understand later on.