This isn't really a Qlik Web Connectors question, so you may be better off moving the conversation to another forum.
However... Your variable code appears to be missing a closing }.
Where you refer to the variable you are missing the dollar sign expansion, it should read:
Also, be careful as variables are case sensitive.
It's always a very good idea to ensure that your expressions are working well before you move things into variables, and then replace bits a little bit at a time - then you know which change (if any) breaks your expression.
Hope that helps.