Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
hobanwashburne
Creator
Creator

Simple toggle button to lock selection

Does anyone know of an example where a button is used to Lock/unlock a selection in a particular list box? I imagine that I'll have to actually have two buttons (one to lock and one to unlock) and a "hide/show" variable depending on the condition.

But the condition I need to check against is:

if (Listbox A is locked show unlock button, else show lock button)

1 Solution

Accepted Solutions
Not applicable

Go to Properties > Actions > Add > Unlock Field > Add Field

Click on Add Again > External > Set Variable > Add variable vLock and set it to 0

Add another button but select Unlock Field.

Click on Add Again > External > Set Variable > Add variable vLock and set it to 1

Then on show hide add something like if(vLock = 1) on the one button and the other button if(vLock = 0).

Place these 2 buttons at the exact same location in your model before you set the conditional hide / show. This way you will never know its actually 2 different buttons.

This should do what you want it to do.


Regards,
Marius

View solution in original post

2 Replies
m_woolf
Master II
Master II

You should be able to use a single button and change the text based on the value of the variable something like:

=if(vLock = 1,'Unlock','Lock')

The action would be:

=if(vLock = 1,0,1)

Not applicable

Go to Properties > Actions > Add > Unlock Field > Add Field

Click on Add Again > External > Set Variable > Add variable vLock and set it to 0

Add another button but select Unlock Field.

Click on Add Again > External > Set Variable > Add variable vLock and set it to 1

Then on show hide add something like if(vLock = 1) on the one button and the other button if(vLock = 0).

Place these 2 buttons at the exact same location in your model before you set the conditional hide / show. This way you will never know its actually 2 different buttons.

This should do what you want it to do.


Regards,
Marius