Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
jim_chan
Specialist
Specialist

How to create a customize filter/selection/listbox

Hi guys,

i have created a pivot table. in my correctio column, actually consists of value C,D.

But my client wants to have a selection box which can give the client a choice of choosing view "C Only", "D Only", "C & D" , "All".

So, i do not know how to create this filter. I have tried to create in the script editor as such:

if(correctio_tip = 'c', 'C',

if(correction_tip='d','D',

if(correction_tip='c' or 'd', 'C & D')))

screenshot.png

Help help help

Rgds

Jim

1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi Jim:

If you want to add more fields on group by, yo need to include it on LOAD:

LEFT JOIN Competition

LOAD

     cust_id,

     date,

     starttime

     concat(DISTINCT correctio_tip,'&') as MyField2

RESIDENT Competition

//if you want, you can add more fields to group, like categories or dates

GROUP BY cust_id, date, starttime;

MyFilter:

LOAD DISTINCT MyField2 as MyFilter RESIDENT Competition;

CONCATENATE

LOAD 'All' as MyFilter AUTOGENERATE 1;

Regards!!!

View solution in original post

34 Replies
Gysbert_Wassenaar

Create a listbox with correction_tip as field. Then let the client select only C or select only D or select C and D both or select nothing which means select all. It's standard functionality. No need to muck about trying to create something that already exists and works.


talk is cheap, supply exceeds demand
jim_chan
Specialist
Specialist
Author

That i know, Gysbert. but i have situation as such that i have created a listbox using field correctio_tip. so this listbox there is "C" , "D".

So when i select/highlight "C" and "D" , it listed out all the Cs and Ds. 

i wanted a list box when i select " C & D" then it will only show me customer ID - 80100317 with correctio_id of "C & D" only.

screenshot.png

Rgds,

Jim

Anonymous
Not applicable

Hi Jim,

Create a new field with C,D, C&D, All, with only one selection.

On field triggers, create a new action on your new field to select values on correctio_id:

IF(GetSelectedCount(NewField)=1 and (NewField='C' or NewField='D'), NewField,

     If(GetSelectedCount(NewField) = 1 and NewField = 'C&D', '(C|D)', ''))

Regards!!

Gysbert_Wassenaar

Ah, like that. Ok try creating a new table with a new field:

NewTable:

LOAD DISTINCT

     cust_id,

     correction_tip as Newfield

RESIDENT

     ExistingTableWithCustIDAndCorrectionTip

     ;

CONCATENATE (NewTable)

LOAD

     cust_id,

     concat(correction_tip, ' & ', correction_tip) as Newfield

RESIDENT

     ExistingTableWithCustIDAndCorrectionTip

GROUP BY

     cust_id

     ;


talk is cheap, supply exceeds demand
jim_chan
Specialist
Specialist
Author

let me try this bro. 

let you know in a while.

jim_chan
Specialist
Specialist
Author

Gysbert,

i have followed your steps, something is not right though... it gave me a long list - in a listbox. like this:

screenshot.png

Rgds

Jim

Gysbert_Wassenaar

Ah, yes of course. Try this for the second part:

CONCATENATE (NewTable)

LOAD

     cust_id,

     concat(NewField, ' & ', NewField) as Newfield

RESIDENT

     NewTable

GROUP BY

     cust_id

     ;


talk is cheap, supply exceeds demand
jim_chan
Specialist
Specialist
Author

maybe u  r rite... wait... maybe i need 1 more key.

Not applicable

Hi Jim,

Try this expression. I hope it will works.

IF(GetSelectedCount(Correction)=1 and (Correction='C' or Correction='D'), Correction,

     If(GetSelectedCount(Correction) = 1 and Correction= 'C&D', '(C|D)', '')).

Thanks,