Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Mini_Elaine
Contributor III
Contributor III

Change button background colour when clicking

Hi,

I am struggling to change button background colour when clicking the button. There are several posts here but none of them seems working....Can anyone help and check where is wrong with my syntax?

I first created a button label as 'Portfolio' in appearance and set action for set variable value with label as 'VPortfolio' , variable as 'VPortfolio', and value as 1. 

Then I changed background colour by expression as the following:

=if(VPortfolio=1, blue(), LightGray())

Error showed this expression and didn't work. Where did I do wrong?

Many thanks!

 

Labels (1)
  • Chart

1 Solution

Accepted Solutions
Javizh
Partner - Contributor III
Partner - Contributor III

Hello @Mini_Elaine 

You need two things:

  • Configure a Button action to "Set variable value" of "VPortfolio" with the following expresion "=if(VPortfolio=1, 2, 1)"
  • Then, configure the color expression with the one you already have.                                      "=if(VPortfolio=1,blue(),LightGray())"

Attached is the QVF with an example.

Best regards.

View solution in original post

3 Replies
Javizh
Partner - Contributor III
Partner - Contributor III

Hello @Mini_Elaine 

You need two things:

  • Configure a Button action to "Set variable value" of "VPortfolio" with the following expresion "=if(VPortfolio=1, 2, 1)"
  • Then, configure the color expression with the one you already have.                                      "=if(VPortfolio=1,blue(),LightGray())"

Attached is the QVF with an example.

Best regards.

Mini_Elaine
Contributor III
Contributor III
Author

Thanks @Javizh 

I might put it into wrong place... Is that where I put the expression?

 

Mini_Elaine_0-1694000429442.png

 

Many thanks!

Javizh
Partner - Contributor III
Partner - Contributor III

Hello @Mini_Elaine 

Its the correct place.

Maybe the problem is that you dont have the variable created? or the name is a bit different?

Javizh_0-1694000705763.png

It should be colored in pink if you click on the "fx"

Best regards.