Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
sebastian_fager
Contributor III
Contributor III

Set Variable in Scrip vs Dashboard

Hi,

I have i problem. The variable works in the dashboard but not in the script. It looks like it cuts of my ' in the end, why?

Script:

Script.png

Dashboard(Script):

Script - dontwork.png

Dashboard Script(and works):

Dashboard-Works.png

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

To represent a quote within the string, code the single quote twice. So a pair of single quotes would be coded as.

LET v1 = 'if(x,y,'''')';

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

View solution in original post

6 Replies
marcus_sommer

Try it with:

set = "YourExpressionIncludingSomeSingleQuotes";

- Marcus

sebastian_fager
Contributor III
Contributor III
Author

Hi,

The script runs without error, but the variable dashboard is blank..

Screenshot 2016-09-06 08.14.07.png

andrespa
Specialist
Specialist

Hi Sebastian, it's as Marcus said. Please have a look to this:

LET and SET

That may clarify the difference in using SET and LET

Hope it helps,

Andrés

sasiparupudi1
Master III
Master III

You can try

let vPackCare='if(len(RavaraNr)=5 and Left(RavaraNr,1)=3,sum(levAntalRavara)/ArtikelVikt),'& chr(39)& chr(39)&')';

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

To represent a quote within the string, code the single quote twice. So a pair of single quotes would be coded as.

LET v1 = 'if(x,y,'''')';

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

sebastian_fager
Contributor III
Contributor III
Author

Thanks works now!