Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Specialist
Specialist

Button to toggle selections

I wish to design a button which toggles between including and excluding a defined selection.

Whatever selections had already been made, the button would include data where (let's say) Field1 = 'A' and Field2 <> 'B'. When the button was clicked again, it would reverse this.

I have looked at using Toggle Select and also at Alternate States but I'm not clear whether these do the job.

I have considered having 2 buttons which are displayed conditionally, but this doesn't seem very elegant.

Any ideas would be welcome.

Thanks

Tags (2)
1 Solution

Accepted Solutions
Highlighted

Re: Button to toggle selections

in the field (of select in field) write your field, in the bottom box write:

=If(GetFieldSelections(Field)='A', '<> B', 'A')

View solution in original post

4 Replies
Highlighted

Re: Button to toggle selections

1) define a variable in the script: LET vToggle = '1';

2) Add the button: Write in the General Tab -> Text: If(vToggle=1, 'Condition 1', 'Condition 2')

3) in the Action Tab ->External -> Set variable Write in the upper box: vToggle, in the bottom box: If(vToggle=1,2,1)

4) in your chart (or table) write: If(vToggle=1, expression 1 (the one with field1 = A), expression 2 (The one with Field <> B)

let me know

Highlighted
Specialist
Specialist

Re: Button to toggle selections

Hi Alessandro

That's a neat way to build a toggle button, and I have used something similar a few times. But what I am struggling to do is find the correct actions within the Button properties.. I can use Select in Field. But I do not know how to base the selection on the value of the toggle variable, vToggle.

Highlighted

Re: Button to toggle selections

in the field (of select in field) write your field, in the bottom box write:

=If(GetFieldSelections(Field)='A', '<> B', 'A')

View solution in original post

Highlighted
Specialist
Specialist

Re: Button to toggle selections

Wow, yes that seems to work.

That's a neat trick I have learnt today!

Thanks