Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

joydipp1988
Contributor

Listbox object to show always one selected value with flexibility to select more than one value from the list

Hi all, swuehljohnwmarcus_sommermarcowedelstalwar1,

I have a list box in my dashboard showing the Year field. I've the following requirement-

1) There will be always one selected value, possibly the current Year,

2) The Clear All button should not work on the Year field i.e. if you click on Clear All button, the Year selection should not clear.

3) User should have the flexibility to select more than one year value from the list box.

Please guide how to achieve all three together. Its a bit urgent so any help will be appreciated.

Thanks in advance.

Joy

3 Solutions

Accepted Solutions

Re: Listbox object to show always one selected value with flexibility to select more than one value from the list

Hi,

maybe one solution might be an OnSelect Field Event Trigger on the Year field with a "Select in Field" action and a Search String expression like:

=If(GetSelectedCount(Year)=0,'('&Concat({$1} DISTINCT Year, '|')&')','('&Concat(DISTINCT Year, '|')&')')

QlikCommunity_Thread_253869_Pic1.JPG

hope this helps

regards

Marco

Re: Listbox object to show always one selected value with flexibility to select more than one value from the list

You're welcome.

Please close your thread once you feel that your question is answered:

Qlik Community Tip: Marking Replies as Correct or Helpful

thanks

regards

Marco

Re: Listbox object to show always one selected value with flexibility to select more than one value from the list

some other expressions that should work as well:

=If(GetSelectedCount(Year),'('&Concat(DISTINCT Year, '|')&')','('&Concat({$1} DISTINCT Year, '|')&')')

or maybe

='('&Concat($(=If(GetSelectedCount(Year),'','{$1}')) DISTINCT Year, '|')&')'

hope this helps

regards

Marco

8 Replies

Re: Listbox object to show always one selected value with flexibility to select more than one value from the list

1) We have option called "Always one select value" - This should be check after selection only

2) In fact, Even if you try with Clear All button or in built it won't effect because you have Always one select value checked

3) This case, Might you need one more object which help by Alternate States

HTH

franky_h79
Honored Contributor

Re: Listbox object to show always one selected value with flexibility to select more than one value from the list

Or go to Setting -->Document Properties --> Triggers  --> Document Event Triggers

and setup Trigger for:

1. OnAnySelect (-->Select in Field: Field = Year, Value = 2017)

2. OnOpen by adding an Action (-->Select in Field: Field = Year, Value = 2017)

Save doc and restart!

Hope this helps

joydipp1988
Contributor

Re: Listbox object to show always one selected value with flexibility to select more than one value from the list

Hi Frank,

Thanks for your quick reply, but I can't select more than one value from the list box. I have to achieve that as well with high priority.

joydipp1988
Contributor

Re: Listbox object to show always one selected value with flexibility to select more than one value from the list

Hi anil,

Thanks for your quick reply. Let see what others suggest.

Re: Listbox object to show always one selected value with flexibility to select more than one value from the list

Hi,

maybe one solution might be an OnSelect Field Event Trigger on the Year field with a "Select in Field" action and a Search String expression like:

=If(GetSelectedCount(Year)=0,'('&Concat({$1} DISTINCT Year, '|')&')','('&Concat(DISTINCT Year, '|')&')')

QlikCommunity_Thread_253869_Pic1.JPG

hope this helps

regards

Marco

joydipp1988
Contributor

Re: Listbox object to show always one selected value with flexibility to select more than one value from the list

Hi Marco,

Its an wonderful solution. Its working fine. Although need to do some R & D to check how its working. Thanks for the help. I'll get back to you after using it more.


Thanks,

Joy

Re: Listbox object to show always one selected value with flexibility to select more than one value from the list

You're welcome.

Please close your thread once you feel that your question is answered:

Qlik Community Tip: Marking Replies as Correct or Helpful

thanks

regards

Marco

Re: Listbox object to show always one selected value with flexibility to select more than one value from the list

some other expressions that should work as well:

=If(GetSelectedCount(Year),'('&Concat(DISTINCT Year, '|')&')','('&Concat({$1} DISTINCT Year, '|')&')')

or maybe

='('&Concat($(=If(GetSelectedCount(Year),'','{$1}')) DISTINCT Year, '|')&')'

hope this helps

regards

Marco