Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Background colour on button

Hi, QlikView Community

I am a simple dataset what you can look at in the excel file.

I have one trouble I am trying to solve regarding background color in button.

I have a button that has actions that is supposed to select two Company Codes (100 and 110).

Also I want the button to change colors when I push the button.

I want the button to change when the Company Codes are 100 and 110 and I want the button to change back when I deselect the company codes.

I tried this formula in the button calculated base color:

=If([Company Code] = '100' and [Company Code] = '110', RGB(0, 240, 16), RGB(15, 48, 99))

but it did not work. Do you have any ideas?

regards Darri

1 Solution

Accepted Solutions
PradeepReddy
Specialist II
Specialist II

try like this..

=if(Concat(distinct [Company Code],',')='2008,2009',RGB(0, 240, 16), RGB(15, 48, 99))

View solution in original post

11 Replies
sathishkumar_go
Partner - Specialist
Partner - Specialist

HI,

Try this

=if(len(GetFieldSelections([Company Code])) > 0,RGB(0, 240, 16), RGB(15, 48, 99))

-Sathish

sathishkumar_go
Partner - Specialist
Partner - Specialist

sinanozdemir
Specialist III
Specialist III

Hi,

I used a variable, please see the attached.

Thanks

Colin-Albert

Use match instead

     if(match([Company Code], 100, 110), RGB(0, 240, 16), RGB(15, 48, 99))

Anonymous
Not applicable
Author

The button becomes green when I select every company code.

I only want it to become green when I select both company code 100 and 110.

And I want it to become blue again when I select something else e.g. company code 130

how can I do that

Anonymous
Not applicable
Author

The button becomes green when I select either company code 100 or 110.

But when I select both 100 and 110 the button becomes blue

I only want it to become green when I select both company code 100 and 110.

how can I do that?

paul_vans267
Partner - Contributor II
Partner - Contributor II

Hi there,

Two methods for you... Method 1 works perfectly I believe:

I changed the colour to be calculated as follows:

=if(num(TextBetween(GetFieldSelections([Company Code]),'(','|')&TextBetween(GetFieldSelections([Company Code]),'|',')'))=100110,RGB(0,240,16),RGB(15,48,99))

This makes sure that those specific values have been selected.  Button changes perfectly.

Alternatively:

I changed the color to be calculated on whether the sum of the Country Code when 100 and 110 are selected is equal to the sum of the rest not being selected.

if(sum({$<[Company Code] =- {'120','130','140'}>}[Company Code])=sum([Company Code]),RGB(0,0,0),RGB(155,155,155))

Problem here is if you select two other fields and they by chance equal the same as 100 and 110 it changes as well.  So I think method 1 is preferable.

Hope this helps

settu_periasamy
Master III
Master III

May be try this

If ( Concat(Distinct  [Company Code],':')='100:110',rgb (0,255,0),rgb (0,0,255))

awhitfield
Partner - Champion
Partner - Champion

Hi Darri,

nearly there, try:

If(GetFieldSelections([Company Code])='(100|110)',RGB(0, 240, 16), RGB(15, 48, 99)) 

HTH Andy