Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
vkal12
Creator
Creator

Building a toggle button without using an extension

Hello everyone,

I am currently trying to build a toggle button without using an extension. I found multiple posts within the community but they all recommend the use of different extensions. I want to use this button for selecting and deselecting values, like a filter pane for a specific value. 

 

Thank you very much!

 

Labels (3)
1 Solution

Accepted Solutions
vkal12
Creator
Creator
Author

Hi, after a lot of trying out I have found a way to set up a toggle button. I've created a container and created a button within that container. I don't know why but if I set up a container and use a button I have different actions to select from. So with the button within the container I can select "Toggle field selection" as action. 

The only bad thing is that if i would want to have more than one toggle button, I would have to create multiple containers with only one button in it. 

But for the moment it works and is the easiest way for me to set it up. 

View solution in original post

6 Replies
saso70
Partner - Creator II
Partner - Creator II

Hi , please check my post https://community.qlik.com/t5/App-Development/Bundle-image-on-QLiksense/m-p/1904554#M74584

Instead images you can use two buttons. Thank you

vkal12
Creator
Creator
Author

Hi Saso70,

thank you for your reply. I read your post but as I am pretty new to Qlik Sense I don't really understand on how to apply this to my problem. 

Can you provide more information to me? 

Thank you very much!

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

This can be achieved with a standard button in Sense.

The basic functionality is to make a selection on a Click:

button.png

 

When that is clicked it will make the selection, as you would expect:

button2.png

So, with two buttons you can turn things on and off within a field.

You can also achieve similar by using the ability to put a function into the label of the button and also into the text which goes into the field selection.

The label, for instance, could have something like:

=if(concat(distinct Part) = 'INT2825', 'Des', 'S') & 'elect INT2825')

This will change between Select INT2825 and Deselect INT2825 based on whether that is the only part selected.

The Value in the Field setting would be similar:

=if(concat(distinct Part) = 'INT2825', null(), 'INT2825')

This will clear the selection (null()) if INT2825 is the only part selected, and make the selection if it is not.

You can build up more complex logic in the functions if you need.

To select multiple you need the following syntax:

='("INT2825"|"ALTO"|"Magnet")'

And you can build a list to select or exclude using the CONCAT statement and bits of Set Analysis.

Hope that points you in the right direction.

Cheers,

Steve

saso70
Partner - Creator II
Partner - Creator II

Hi Please check the qvf file you have solution inside the app . I hope will be useful. Thank you

vkal12
Creator
Creator
Author

Hi, after a lot of trying out I have found a way to set up a toggle button. I've created a container and created a button within that container. I don't know why but if I set up a container and use a button I have different actions to select from. So with the button within the container I can select "Toggle field selection" as action. 

The only bad thing is that if i would want to have more than one toggle button, I would have to create multiple containers with only one button in it. 

But for the moment it works and is the easiest way for me to set it up. 

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @vkal12 ,

There really is no reason why an object in a container should behave any different to an object outside of a container. Are you sure you don't have two different Button objects installed (perhaps from where Qlik deprecated one and moved to a new one) and you used a different one in the container to outside of it?

The issue with containers is that they take up extra space on the screen, even when showing a single object and they can make things more awkward to get to and edit.

Steve