Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Restrict button depending on current selection .

I want to restrict a button depending on current selection .
Lets say I've 50 fields and I want the button to be displayed only if I've made a selection on  two specific columns ,eg A & B.

So if I have a selection on A or B but I also select any other field C or D the button should be greyed out .

I hope the experts are able to help me out .

Regards

MS

5 Replies
Not applicable
Author

Hi

Have you already try the 'enable condition' on general tab?

You can put some expression there to activate or deactivate your button.

TMF

Not applicable
Author

I think you have to put all the values in the 'Enable Condition'

Try something like:

A='1' OR A='2' OR B='3'...

TMF

Not applicable
Author

Hi ,
Thanks for your reply .

I'm already using the below in enable condition :

WildMatch(GetCurrentSelections(),'*A*','*B*') <>0
and
IsNull(WildMatch(GetCurrentSelections(),'*A*','*B*')) =0

But I cannot point out the unwanted ones as they could run into 40 -50 fields .
Is there any other solution that you could think off ?

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this

=If(GetSelectedCount(A) > 0 AND GetSelectedCount(B), 1, 0)

OR you can also try using

GetFieldSelections() instead of GetSelectedCount()

Regards,

Jagan.

Not applicable
Author

Hi Jagan,


It's close but doesnt help .
Here your code needs a selection to be made on both A & B for the button to be enabled .
I want button to be enabled for any of the below selections :
1)A
2)B
3)A&B

& it should be disabled if I select A & C  or A,B,C like that .
This C which I'm talking about could be  any field from the remaing set of 50 other fields .
So I can't hardcode them as its a dirty fix .

Hope you get my point and there is a solution .

Regards,
MS