Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

chriys1337
Contributor

Formula in a Script Variable

Hi,

I am trying to put a  formula into a Variable (in the script), but the generator puts out an Script Line Error:

LET vL.FieldSelection_Plus1='=if(right(GetFieldSelections(Selection),2)= '51' or right(GetFieldSelections(Selection),2)= '52', left(GetFieldSelections(Selection),4)+1 &'01',GetFieldSelections(Selection)+1)'; // 2. Kickout, -2 to +1 from Selection 

In a Textbox this script works, but how to put it in a variable in the script?

I am happy for any hint.

Kind Regards,

Chris

Tags (1)
1 Solution

Accepted Solutions
MVP
MVP

Re: Formula in a Script Variable

May be try with SET instead of LET

SET vL.FieldSelection_Plus1 = =if(right(GetFieldSelections(Selection),2)= '51' or right(GetFieldSelections(Selection),2)= '52', left(GetFieldSelections(Selection),4)+1 &'01',GetFieldSelections(Selection)+1);

3 Replies

Re: Formula in a Script Variable

May be this?

LET vL.FieldSelection_Plus1 = if(right(GetFieldSelections(Selection),2)= '51' or right(GetFieldSelections(Selection),2)= '52', left(GetFieldSelections(Selection),4)+1 &'01',GetFieldSelections(Selection)+1);


Then create text object and use $(vL.FieldSelection_Plus1) and then see

MVP
MVP

Re: Formula in a Script Variable

May be try with SET instead of LET

SET vL.FieldSelection_Plus1 = =if(right(GetFieldSelections(Selection),2)= '51' or right(GetFieldSelections(Selection),2)= '52', left(GetFieldSelections(Selection),4)+1 &'01',GetFieldSelections(Selection)+1);

chriys1337
Contributor

Re: Formula in a Script Variable

I did it like you suggested, without '' (comma)  and with the SET command. It works in the frontend with a textbox with =vL.FieldSelection_Plus1

Very strange, I thought SET is not computing ... and would need $(), but somehow it works without...

Community Browser