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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

ListBox Filters Based on 'Contains' rather than 'Equal To'

I'm new to Qlikview and hopefully this is an easy question...

I would like to create a List Box that will filter the results based on whether the field 'contains' the selected item rather than being 'equal to' the selected item.

For example: using the Example Data Set and Example List Box Selections below...

If the user selects 'New' from the List Box Selections, I want to show records where the 'Category' field contains 'New'.  (Would show Cutstomer1, Customer2, Customer3, and Customer7)

Example Data Set:

CustomerCategory
Customer1New;Regional;FastPay;Manual
Customer2New;Local
Customer3FastPay;New;Automatic;GroundOnly
Customer4Existing;FastPay;Automatic
Customer5Local;SlowPay;AirOnly;Type3
Customer6Existing;Regional;
Customer7SlowPay;GroundOnly;Manual;New

Example List Box Selections:

Category Types
AirOnly
Automatic
Existing
FastPay
GroundOnly
Local
Manual
New
Regional
SlowPay
Type3

Thanks,

John

2 Replies
MK_QSL
MVP
MVP

Load the first table as below

Load Customer, Subfield(Category,';') as Category From TableName;

Now Create a list box Category... Hope this will help..

Not applicable
Author

Try the below script in your qvw.

 

temp:

LOAD
F1 as temp_Customer, F2 as Type
INLINE [
F1, F2
Customer1, New;Regional;FastPay;Manual
Customer2, New;Local
Customer3, FastPay;New;Automatic;GroundOnly
Customer4, Existing;FastPay;Automatic
Customer5, Local;SlowPay;AirOnly;Type3
Customer6, Existing;Regional;
Customer7, SlowPay;GroundOnly;Manual;New
]

;

temp1:
LOAD max(SubStringCount(Type,';'))+1 as maxlength Resident temp

;

let vmaxlength
=

FieldValue('maxlength',1);


for

i=0

to

vmaxlength

Data:

LOAD

Distinct

temp_Customer

as

Customer ,

SubField(

Type,';',

$(i))

as

CustomerType

Resident temp;

NEXT;

Output:

NoConcatenate

LOAD

Distinct *

Resident Data

Where

len(

Trim(

CustomerType))>0;

DROP

Tables Data,temp,temp1;

May not be the best solution, but it works!!

Thanks,

Surendra