Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

operator precedence in qlikview load script

Hi All,

I have requirement to eliminate some data based on  filter criteria in load script. for example while loading data using load script

Product: a, b, c, d, e

channel :hsp, mules, pharma

country: us

I need to load all data for all products and all type of channels till end of June for us. from July month I need load all data for all product ,and I need to exclude data that have product c, channel pharma from july.but I need to load the data product c wich have channel hsp and mules and all data till june.

I have written logic in where condition like below:

load * from

XXXX

where (country=us and (and channel <>'pharma' and date <'20170701' and mot match(product, 'c')))

by using above  expression it is excluding all data belongs to channel pharma, product c and not fetching any data for july irrespective of precedence.

I need to eliminate only data that satisfies the  3 filter criteria i.e product c, channel pharma whose dat is in july

2 Replies
sunny_talwar

Would you be able to share few rows of data to test this out?

Anonymous
Not applicable
Author

I would probably do it in multiple loads and concatenate them.

load *

from XXXX

where Country='US' and not match(Channel,'Pharma') and match(Product,'c') and Date>='20170701';

concatenate

load *

from XXXX

where Country='US' and match(Channel,'Pharma') and not match(Product,'c') and Date>='20170701';

concatenate

load *

from XXXX

where Country='US' and not match(Channel,'Pharma') and not match(Product,'c') and Date>='20170701';

concatenate

load *

from XXXX

where Country='US' and not match(Channel,'Pharma') and not match(Product,'c') and Date<'20170701';

concatenate

load *

from XXXX

where Country='US' and Date<'20170701';

To put it all in one you would probably need something like:

load *

from XXXX

where (Country='US' and not match(Channel,'Pharma') and match(Product,'c') and Date>='20170701') OR

          (Country='US' and match(Channel,'Pharma') and not match(Product,'c') and Date>='20170701') OR

          (Country='US' and not match(Channel,'Pharma') and not match(Product,'c') and Date>='20170701') OR

          (Country='US' and not match(Channel,'Pharma') and not match(Product,'c') and Date<'20170701');

;