Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Grouping a field and displaying customized names in a listbox

Hi, I am trying to create a filter based on the requirement in a listbox. For ex. FieldName is Status (Id column) and has 10 values from 1 to 10.

Status

1

2

3

4

5

6

7

8

9

10.

So, i want to create a filter like

if Status = 10, 'Completed'

if Status <> 9 and Status <> 10, 'Open'

finally, 'Any' for all values of Status. My list box will look like as in the attachment.

I have used below if condition, but its not working as I expected. First two conditions were fine, but for 3rd condition ('Any'), instead of all values, its showing only value '9'.

Any help will be greatly appreciated and thanks in advance for your hlep.

1 Solution

Accepted Solutions
Not applicable
Author

I achieved this task by adding each button for each selection and then used container to group all the 3 buttons. Also, I created a variable to change the color of the button once you selected. Any ways, thank you all for your wonderful suggestions and time.Listbox1.png

View solution in original post

9 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

I'd recommend to solve it in the Data Model and load the Status Descriptions associated with the Status numbers.

In a calculated formula, you can only assign one Name per number. In order to associate all statuses with the name 'Any', it's best to create a data table.

Cheers,

Oleg Troyansky

Upgrade your Qlik skills at the Masters Summit for Qlik - coming soon to Milan, Italy!

Not applicable
Author

Hi Oleg, Thanks for the suggestion. But, could you please explain in more details how can I achieve that. I would like to do it in front end than in back end. So, please suggest me.

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

My point was that you cannot do it in the front end, only in back end - because you need to associate multiple names with the same number.

maxgro
MVP
MVP

Source:

load * inline [

S

1

2

3

4

5

6

7

8

9

10

];

load S, 'Any' as Status Resident Source;

load S, if(S=10, 'Completed') as Status Resident Source;

load S, if(not match(S, 9,10), 'Open') as Status Resident Source;

1.png

HirisH_V7
Master
Master

Hi,

There you are mentioning clearly the conditions like that right ,

Status 10 completed

Status with out 9 and 10  open , Means 1- 8 are OPEN

Lastly  remaining Status code is 9 right that is treated as Any

If(Status<>9 and Status<>10,'Open',If(Status=10,'Completed',If(Status=Status,'Any')))as FilterStatus

HTH,

HirisH

HirisH
“Aspire to Inspire before we Expire!”
Not applicable
Author

Hi MG, Thanks for your help. However it did not work. In the example you mentioned above, if you select 'Open' in Status, all the values from 1 to 8 should be highlighted in GREEN. Similarly for other options as well. If I select 'Any', all the values of S should be highlighted in GREEN.

Not applicable
Author

Hi Hivish, I tried your solution too, but it dint work either. I believe that Oleg is correct and I can not do it in front end. Instead of Listbox, I am thinking to use a button for each selection. I will try that approach and will post here. But, if anyone has solution for this, please share with me.

maxgro
MVP
MVP

try adding a trigger on the Status field

Not applicable
Author

I achieved this task by adding each button for each selection and then used container to group all the 3 buttons. Also, I created a variable to change the color of the button once you selected. Any ways, thank you all for your wonderful suggestions and time.Listbox1.png