Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

string variable in formulas

I have a table where I use the same expression

sum(if(NAME <> 'US Sales - Multi Year Portion' AND InMonth(STARTDATE,today(1),-x,1,0))

where "x" can be from 1 to 5, to show the leads that started in the last six months. I will probably have to add some other criteria

to this selection in the future, so I thought that if I could create a variable "vExpr1", that would only contain:

NAME <> 'US Sales - Multi Year Portion' AND InMonth(STARTDATE,today(1),

and then my formula for every column would be sum(if($(vExpr1)-x,1,0)

I could add another condition (say AND Status <> '019' ) by just changing the definition of vExpr1.

However, I tried

SET vExpr1 = 'NAME <> 'US Sales - Multi Year Portion' AND InMonth(STARTDATE,today(1),'

and that didn't work.

then I tried

SET vExpr1 = 'NAME <> '&CHR(39)&'US Sales - Multi Year Portion'&chr(39)&'AND InMonth(STARTDATE,today(1)';

and that didn't work either.

First, is this a good idea (using the variable instead of spelling out each formula)

Second: If yes, what's the best way to do this?

thanks,

Kevin

1 Solution

Accepted Solutions
MVP
MVP

Re: string variable in formulas

Try this for the variable definition:

SET vExpr1 = NAME <> 'US Sales - Multi Year Portion' AND InMonth(STARTDATE,today(1),;

2 Replies
MVP
MVP

Re: string variable in formulas

Try this for the variable definition:

SET vExpr1 = NAME <> 'US Sales - Multi Year Portion' AND InMonth(STARTDATE,today(1),;

Not applicable

Re: string variable in formulas

thanks, Stefan. Worked perfectly!

Community Browser