Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
ValeriaBonini
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

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

 

anat
Master

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

marcus_sommer

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

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

N30fyte
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.