Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
sergio0592
Specialist III
Specialist III

Only selection in list box


Hi all,

I can't remember how to allow for user to select only one item in a selection list.

Regards

1 Solution

Accepted Solutions
rahulpawarb
Specialist III
Specialist III

Hello Jean-Baptiste RENAULT,

Trust that you are doing well!

As a workaround, you can follow below steps:

1. Open Triggers tab of Document Properties (Settings Menu -> Document Properties -> Triggers Tab).

2. Add an event on OnSelect event (Field Event Triggers Section -> On Select - Add Actions)

  Press Add button, select Action Type as Selection & Action as Select in Field. Enter Field Name and Search String as below:

Field Name: Category

Search String: =If(GetSelectedCount(Category), MaxString(Category))

Field Name: Year

Search String: =If(GetSelectedCount(Year), Max(Year))

Hope this will be of help.

Regards!

Rahul

View solution in original post

8 Replies
Anil_Babu_Samineni

Are you talking about Always One Selected Value

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
avinashelite

Try like this

*Make a selection in the List box

*Properties >General > Always one selected value

NOTE: If you are using expression in list box this doesn't work

sergio0592
Specialist III
Specialist III
Author

Always one selected value don't allows selection of more than one item. Ok, it was my goal, but i'd like to get not always a selected value.

Anonymous
Not applicable

Do you mean, Clear all should clear the selection of the list box??

sergio0592
Specialist III
Specialist III
Author

I'd like the following things :

-user can't select more than one item

-user can select no item

Anonymous
Not applicable

Am not sure if its possible As a work around,

Add a trigger in the Document properties for field selection - > select in field, if getselectedcount()>1 then choose some value from the selections.

rahulpawarb
Specialist III
Specialist III

Hello Jean-Baptiste RENAULT,

Trust that you are doing well!

As a workaround, you can follow below steps:

1. Open Triggers tab of Document Properties (Settings Menu -> Document Properties -> Triggers Tab).

2. Add an event on OnSelect event (Field Event Triggers Section -> On Select - Add Actions)

  Press Add button, select Action Type as Selection & Action as Select in Field. Enter Field Name and Search String as below:

Field Name: Category

Search String: =If(GetSelectedCount(Category), MaxString(Category))

Field Name: Year

Search String: =If(GetSelectedCount(Year), Max(Year))

Hope this will be of help.

Regards!

Rahul

chhavi376
Creator II
Creator II

Hi Jean,

You can add a trigger(On OnSelect/OnChange) on the field you want to be always one value selected:

=If(GetSelectedCount(FieldName)=0,MaxString({$1}FieldName),'('&Concat(FieldName,'|')&')').

(This expression would make sure that always one value is selected, and multiple values can also be selected)

=If(GetSelectedCount(FieldName)=1,FieldName,MaxString({$1}FieldName)).

(This would make sure that one and only one value is selected)

This should cater to your requirement.

Make sure that always one selected value is disabled.

Thanks,

Chhavi