Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
AnnaEKinch
Partner - Contributor III
Partner - Contributor III

Enable chart condition

Hi!

I want to enable a button when I have a bookmark for 3 values applied.

My Field is "Location" and the values I have selected are "ANKM9","ANKMR","ANKMRL" for the button to appear.

I thought this would work: 

If([Location No.]='ANKM9'and [Location No.]='ANKMR'and [Location No.]='ANKMRL',1,0)

But it doesn't.

Any ideas how I can solve this problem?

2 Solutions

Accepted Solutions
stevejoyce
Specialist II
Specialist II

Is it just those specific 3 values or any 3?

Any 3 would be GetSelectedCount([Location No.]) = 3.

 

Those specific 3 and only those 3, how about... GetFieldSelections([Location No.]) = 'ANKM9, ANKMR, ANKMRL' ... which uses default sorting of alpha of your field selections.

View solution in original post

stevejoyce
Specialist II
Specialist II

Yes, it looks like the auto sorting of this function changes if selection is not a possible value.  So you can either do 3 matches for each value or this should work:

=GetSelectedCount([Location No.]) = 3 AND count(distinct {<[Location No.]= P([Location No.]) * {'ANKM9', 'ANKMR', 'ANKMRL' } >} [Location No.]) = 3

 

which is saying, user has selected exactly 3 locations AND the count of locations available in their selections intersected with those specific 3 = 3.  Should logically be accurate.

View solution in original post

8 Replies
stevejoyce
Specialist II
Specialist II

Is it just those specific 3 values or any 3?

Any 3 would be GetSelectedCount([Location No.]) = 3.

 

Those specific 3 and only those 3, how about... GetFieldSelections([Location No.]) = 'ANKM9, ANKMR, ANKMRL' ... which uses default sorting of alpha of your field selections.

AnnaEKinch
Partner - Contributor III
Partner - Contributor III
Author

Thank you! Yes, the three specific fields and it worked perfectly!

Now my problem is when I add another field selection, and not all the 3 locations are included, the button is disabled.

I have tried adding the action to lock the selections but this didn't work either. Any ideas? 

stevejoyce
Specialist II
Specialist II

Yes, it looks like the auto sorting of this function changes if selection is not a possible value.  So you can either do 3 matches for each value or this should work:

=GetSelectedCount([Location No.]) = 3 AND count(distinct {<[Location No.]= P([Location No.]) * {'ANKM9', 'ANKMR', 'ANKMRL' } >} [Location No.]) = 3

 

which is saying, user has selected exactly 3 locations AND the count of locations available in their selections intersected with those specific 3 = 3.  Should logically be accurate.

AnnaEKinch
Partner - Contributor III
Partner - Contributor III
Author

Perfect! This worked:

=GetFieldSelections([Location No.]) = 'ANKM9, ANKMR, ANKMRL' or GetFieldSelections([Location No.]) = 'ANKMR, ANKM9, ANKMRL'or GetFieldSelections([Location No.]) = 'ANKMRL, ANKM9, ANKMR'

But unfornutaely not your other suggestion. Thanks so much.

Ok, hopefully last question, I need the similar function for the locations

'ANKM4, MEKA100, MEKB1, MEKB10, MEKB50, MEKB100, MEKC1' This does't work. If I instead do this :

'ANKM4 MEKA100 MEKB1 MEKB10 MEKB50 MEKB100 MEKC1' Then it gets enabled only if I also select  MEKC10. But I do not want MEKC10.

What do you think?

stevejoyce
Specialist II
Specialist II

What if you add this ignore field selections, i definitely think this should work and would make it simpler going forward

 

=GetSelectedCount([Location No.]) = 3 AND count(distinct {1<[Location No.]= P([Location No.]) * {'ANKM9', 'ANKMR', 'ANKMRL' } >} [Location No.]) = 3.

 

If you have to go down the route of GetFieldSelections, then i would instead do below.  This should be fine extending to your other scenario.

=match('ANKM9', $(=chr(39) & GetFieldSelections([Location No.], chr(39) & ', ' & chr(39)) & chr(39)))

AND 

match('ANKMR', $(=chr(39) & GetFieldSelections([Location No.], chr(39) & ', ' & chr(39)) & chr(39)))

AND

match('ANKMRL', $(=chr(39) & GetFieldSelections([Location No.], chr(39) & ', ' & chr(39)) & chr(39)))

AnnaEKinch
Partner - Contributor III
Partner - Contributor III
Author

You are so good!

The first alternative still doesn't work.

The second one is so much easier than making multiple combinations of selection-orders. This works great for my three locations, but still doesn't work on my seven locations. Hmmm.

stevejoyce
Specialist II
Specialist II

Hm i can't think of anything.  Can you send me the list of your Locations and your calculation?

AnnaEKinch
Partner - Contributor III
Partner - Contributor III
Author

Hi!

I made an Inline table grouping the locations. Then so  much easier with just one field value per group to consider each time!

Many thanks again for wonderful help!