Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
RealGrynomics
Contributor
Contributor

Setting variable in Script not evaluating as expected?

Hi Everyone,

I'm looking to see if anyone could fix my problem.

I can create a variable on the front end of my app, I call it ThreeYears and in the expression editor it is defined as so:

='>=$(=monthstart(addmonths(max(MonthYearComplete),-35)))<=$(=addmonths(monthend(max(MonthYearComplete)),0))' 
 
MonthYearComplete is a field whose values are in the form MMM-YYYY.
 
The above returns >=01/02/2018<=31/01/2021 which is the result I want
 
Instead I would like to define this in script but when I do the following:
LET ThreeYears = '>=$(=monthstart(addmonths(max(MonthYearComplete),-35)))<=$(=addmonths(monthend(max(MonthYearComplete)),0))' 
it returns >=<=
 
How do I change the Script so that it returns >=01/02/2018<=31/01/2021 ?
1 Reply
GaryGiles
Specialist
Specialist

@RealGrynomics 

You need to prevent the $ expansion from occuring in the script for your variable definition.  Try defining the Let statement in the script like this:

Let ThreeYears = '>=$'&'(=monthstart(addmonths(max(MonthYearComplete),-35)))<=$'&'(=addmonths(monthend(max(MonthYearComplete)),0))';