Skip to main content
Announcements
Do More with Qlik - Qlik Cloud Analytics Recap and Getting Started, June 19: REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Enable button Only when one distinct value is selected in table

Hi all,

I require a conditional statement to enable a button when one distinct value is selected in a straight/pivot table?

E.g.

table A:

client_num  expression

1                    25

2                    30

3                    35

1                    40

Button is disabled by default.  However if the user selects one distinct value in field 'client_num' the button should switch to enabled.  e.g. if a user selects client_num '1' the table should have 2 rows but since it contains one distinct value (i.e. 1)  the button should switch to enabled.

I appreciate any assistance! 


6 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this expression.

     =if(getselectedcount(client_num)=1,1,0)

     Use this in layout property of the button to hide and show the button.

Regards,

Kaushik Solanki

Message was edited by: Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     Ignore above post.

     Use this

     =if(getselectedcount(client_num)=1,1,0)

     Use this expression in layout tab of the button properties to hide and show the button.

Rergards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Button -> Properties -> General -> Enable condition: =if(only(client_num)=1, 1, 0)

Not applicable
Author

Thanks Kaushik, however your solution will only display the button when there is only one row selected in the table.  I need the button to show when there is one distinct value selected e.g. if client_num '1' is selected in my example table two rows would be displayed..in this instance I need the button to be displayed (note some clients may have one or multiple rows).  Any other idea?

Cheers

Not applicable
Author

Guys,  I have found the answer...I just need to use :

=if(only(client_num ), 1, 0)  to enable/disable the button.

Thanks again

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

     have a look at the attached example.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!