Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

OR & AND Conditions for filters

Hi All,

This is my table

   

surveyprod ctgcharchar typereqrcrntreco
s1hpdry gripcomfort846
s1hpdexsafety766
s1hpflexprotection978
s2hpdry gripcomfort957
s2hpdexsafety977
s2hpflexprotection989
s2bpoil factorcomfort747
s2bpsweat factorsafety867
s2bpflexprotection989

I have created Set of filters by using this thread

Passing a set of filters in qlikview

Now my requirement is: I want apply 'OR' Condition for result set

i want output like this:

    I have selected  these selections from the  categories as set1 filter

prod ctgchar typecharrange
hpprotectionflex4-8
bpprotectionflex5-9

So now i want to show the output like this for 'OR' Condition:

HP or BP:

     

surveyoutput reqrcrntreco
s1hpflexprotection978
s2hpflexprotection989
s2bpflexprotection989

For AND condition:

HP and BP:

 

surveyoutput reqrcrntreco
s2hpflexprotection989
s2bpflexprotection989

Can you guys help me out from this please

Thank you in advance

Regards,

B V S Sudhakar

9 Replies
Highlighted

Re: OR & AND Conditions for filters

Did you create a sample document which we can look at? It might help to see where you are doing this to help you move forward

Highlighted
Creator II
Creator II

Re: OR & AND Conditions for filters

HI Sunny,

I cant share the data file due to data confidentiality. i have implemented the same as mentioned in Passing a set of filters in qlikview thread - Rob's answer - file name : CollectFilters_294299..

in the vFilterStates (variable) there is "&" to concatenate the results for filter 1 , filter 2 and other respective filters applied. 

as suggested by Rob , here My result set is giving the data for filter 1 and when filter 2 is selected the result for filter 2 is appended with the result of filter set 1 ;..

but what i want is the result set should satisfy both the or all the applied filters set's and then click apply filter and then the data shows up

any ideas on this ?

Thanks,

BVS

Highlighted

Re: OR & AND Conditions for filters

There are few questions for you

1) Which one of these is your desired output

Capture.PNG

2) & is just used to create a string... I am not sure why you want to replace it . Are you may be looking to replace + with *?

=if(len(GetCurrentSelections('','','',1,'Filter1'))>0, 'Filter1*','')

& if(len(GetCurrentSelections('','','',1,'Filter2'))>0, 'Filter2*','')

& if(len(GetCurrentSelections('','','',1,'Filter3'))>0, 'Filter3*','')

& if(len(GetCurrentSelections('','','',1,'Filter4'))>0, 'Filter4*','')

& if(len(GetCurrentSelections('','','',1,'Filter5'))>0, 'Filter5*','')

& '0'

Highlighted
Creator II
Creator II

Re: OR & AND Conditions for filters

Hi Sunny ,

I prepared the set filters by using this file

https://community.qlik.com/servlet/JiveServlet/download/1453725-318528/CollectFilters_294299.qvw

but i want one small change. instead of the & filters in the variable i want to pass the data which will satisfy all the 5 filters applied.

which means the data which matches all the filters in 5 sets should only display in the result chart / table.

Should i change in the vFilterStates variable expression or should i modify the expression in the chart.

Kindly suggest on how to achieve this.

Thanks

Highlighted

Re: OR & AND Conditions for filters

I understand... did you try the above mentioned changes?

Highlighted
Creator II
Creator II

Re: OR & AND Conditions for filters

Yes, But it's not working

Highlighted
Creator II
Creator II

Re: OR & AND Conditions for filters

I want Show second one (AND Condition)

Highlighted

Re: OR & AND Conditions for filters

I don't think I am able to understand....

Second one?

Highlighted
Creator II
Creator II

Re: OR & AND Conditions for filters

Hi sunny,

Here I attached qvw file in that file i want match filter1 and filter 2 values which means like this

If i select for filter 1: Baby Clothes in Category Name, Aino Shoes from Product name, 2012 from Year and

for filter2:Baby Clothes in Category Name, Deuce Shirt from Product name, 2013 from Year

then i want out like this

       

24222/16/2012Baby ClothesAino ShoesHalle KölnBob Park41
24222/16/2012Baby ClothesDeuce ShirtHalle KölnBob Park11
46651/21/2013Baby ClothesAino ShoesLa Moda d'il FuturiRicardo Gucci61
46651/21/2013Baby ClothesDeuce ShirtLa Moda d'il FuturiRicardo Gucci12