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

Announcements
Note: You may notice some temporary visual or styling issues in the Community. Our vendor is actively investigating.
cancel
Showing results for 
Search instead for 
Did you mean: 
rebelfox
Creator
Creator

Button Toggle Field A, B Or None

I would like to set up a Button that can toggle three possible selections on the same field.

1) Field = a value of 'A'

2) Field = a value of 'B'

3) Field Clear ( i.e. no selection )

I can do this with a list box but a button just looks better.

However I have not been able to find a combination that does all three on one button.

I can add 'Select In Field' and set the Search String to =if(MyField=A,B,A) but this just toggles between A and B.

I can do the same thing by  adding two Toggle Select entries.  One where the Search String is equal to 'A' and one where it is equal to 'B' but I can't figure out how to add the third option of no selection.  I tried adding a third 'Clear Field' action but this takes priority over the two Toggles for some reason.

Anybody any ideas?

1 Solution

Accepted Solutions
Not applicable

Please try this expression in "Select in Field":

=if(

IsNull(GetFieldSelections(MyField))=-1,'A',

    if((GetFieldSelections(MyField))='A','B'

    )

)

Please find the attached QVW

View solution in original post

4 Replies
sunny_talwar

Have not tested it, but may be this:

If(MyField = 'A', 'B', If(MyField = 'B', '', 'A'))

Not applicable

Please try this expression in "Select in Field":

=if(

IsNull(GetFieldSelections(MyField))=-1,'A',

    if((GetFieldSelections(MyField))='A','B'

    )

)

Please find the attached QVW

rebelfox
Creator
Creator
Author

That's quite magnificent!

I didn't know '-1' is used for non-selection and only had a vague idea over GetFieldSelections use so that's a great little example.

rebelfox
Creator
Creator
Author

a