Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
ValeriaBonini
Partner - Creator
Partner - Creator

Quotation marks in a variable in load script editor

Hi, don't ask why but i need to have a variable in the script editor with this value: 

set vBackgroundColor= if(GetFieldSelections(name)='mario',hex_color, vBackgroundColor) ;

and then in the background color settings in a button I need to put this variable.

is this possible? i'm having problems because of the ' ' 

 

4 Replies
anat
Master
Master

what color you want to display if mario not selected in the name field?

 

anat
Master
Master

set vBackgroundColor= if(GetFieldSelections(name)='mario',red(), blue()) ;

marcus_sommer
MVP
MVP

You may try to wrap the variable-content with double-quotes, like:

set vBackgroundColor= "if(GetFieldSelections(name)='mario',hex_color, vBackgroundColor)";

N30fyte
Creator
Creator

This works for me:

set vBackgroundColor = "=if(GetFieldSelections(name)='mario',Red(),Blue())";

Note the = sign inside the double quotes.

(Hat tip to an old post by @hic Solved: Conditional variable - Qlik Community - 928539)

But if itsa-not-Mario, you are trying to set vBackgroundColor to itself and I don't know how successful that will be.