Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
rahulbb99
Contributor
Contributor

get all possible matches in result by applying filter

Hi All,

I have Table A, CTD field (Values are separated by space.)

Id CTD Country CTD_Section_Id
1 1.2.A.1 IND 1
2 1.2.B.2 US 2
3 2.1.A.1 UK 3
4 2.1.B.1 IND 4
5 3.1.A.1 US 5
6 1.2.A.1 1.2.B.2  UK  
8 2.1.A.1 2.1.B.1 3.1.A.1 1.2.B.2  IND  

 

Table B contains:

CTD_Section_Id CTD_Section
1 1.2.A.1
2 1.2.B.2
3 2.1.A.1
4 2.1.B.1
5 3.1.A.1

 

If value 1.2.A.1 selected from CTD_Section (filter - Table B)

Expected Result: all rows with 1.2.A.1 value in CTD column (Table A).

Id CTD Country CTD_Section_Id
1 1.2.A.1 IND 1
6 1.2.A.1 1.2.B.2  UK  

 

I tried using variable & expression, It worked but it stopped other filters e.g country.

Thanks you advance.

3 Replies
anat
Master
Master

can u give a try like below..

create a variable v1=GetFieldSelections(CTD_Section)&'*'

in table for ID expression like :only({<CTD_Section=,CTD={'$(v1)'}>}Id)

 

rahulbb99
Contributor
Contributor
Author

Thank you Anat for valuable input.

Previous Applied Solution:

Variable: vTest: '"*'&replace(concat(Distinct [CTD_Section],','),',','*"'&','&'"*')&'*"'

Expression: count({1<[CTD Section]={$(=$(vTest))}>}1)

 

Solution Suggested:

Variable v1:GetFieldSelections(CTD_Section)&'*'

Expression: only({<CTD_Section=,CTD={'$(v1)'}>}Id)

 

I tweaked little:

Variable: v1='"*'GetFieldSelections(CTD_Section)&'*"'

Expression: only({$<CTD_Section=,[CTD]={$(v1)}>}[CTD])

 

both working and giving desired output in table with all combinations of CTD_Section in CTD.

But other filters are not working as expected, filter where combination present in CTD field, all relevant filter values for same are missing from filters (e.g country,...)

e.g.

Id

CTD

Country

CTD_Section_Id

1

1.2.A.1

IND

1

6

1.2.A.1 1.2.B.2 

UK

 

Record Id 1 is getting in result but record Id 6 and relevant country and other filter values not appearing in filter.

 

My observation:

I have joined these 2 tables based on CTD_Section_Id, default association we bypass by applying our solution. And due to this relevant filter values are missing from filter.

 

Can it be possible without hard coding it? or am i missing something?

 

Thanks

AB18
Contributor
Contributor

Hi Rahul,

Please have a look at script attached and twik the code according to your need.

Hope this works for you