Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to write data script editor when you have multiple filter condition

if i have two table- Table1 and Table2 and i have filter condition just like as --- Table.1cust_id=123 and Table2.cust_name='Abhijit' or Table1.cust_id<=4567 and Table2.Cust_name='JOHN'.So, in this scenario, how can i write the load script editor into qlik.

Here , i also used Qualify, unqualify  Syntax

Qualify*;

Unqualify Product_id;

Load  *

From lib://'connection'/Table1.qvd (qvd);

Load *

From lib://'Connection'/Table2.qvd (qvd);

So, my question , where i will use this filter condition.

9 Replies
rajender_qlik
Creator
Creator

Data_Temp:

Load *

From lib://'connection'/Table1.qvd (qvd);

Concatenate

Load *

From lib://'Connection'/Table2.qvd (qvd);

Store Data_Temp into [lib://'Connection'/Final_Table.qvd](qvd);

Drop table Data_Temp;

Data:

Load *

From [lib://'Connection'/Final_Table.qvd](qvd) where Table.1cust_id=123 and Table2.cust_name='Abhijit' or Table1.cust_id<=4567 and Table2.Cust_name='JOHN';

clondono
Creator III
Creator III

Hi Abhijit,

Not sure if I understood your question, but maybe something like this?

Qualify*;

Unqualify Product_id;

Load  *

From lib://'connection'/Table1.qvd (qvd)

where cust_id=123 and cust_name='Abhijit';

Load *

From lib://'Connection'/Table2.qvd (qvd)

where cust_id<=4567 and cust_name='JOHN';

Anonymous
Not applicable
Author

Actually, Table1 has so many many values just like as-CUST_ID, PRODUCT_ID, .........ETC

   AND Table2 also hold so many values----Cust_name, Product_id,.............etc.

Only, Product_id is common for both table .I want to join two table using this product_id field.That's why i applied qualify syntax to avoid synthetic keys and also unqualify product_id column.

Qualify*;

Unqualify Product_id;

Load  *

From lib://'connection'/Table1.qvd (qvd)

where cust_id=123 and cust_name='Abhijit';

Load *

From lib://'Connection'/Table2.qvd (qvd)

where cust_id<=4567 and cust_name='JOHN';

if i applied this syntax--where cust_id=123 and cust_name='Abhijit' into first Table1, i am seeing error mesaage just like as--'''cust_name has not exists into Table1""". So, my question is that, in that case, how can i apply this filter condition

avinashelite

Do you have the column cust_id in table 1 ???? if not you can't refer those columns

share the script , will check and let you know

qlik4asif
Creator III
Creator III

Since you have used qualify * before loading table

So now the field cust_id is changed to table.cust_id     (here the table is name of ur table

so use table.cust_id in where condition not the cust_id

Load  *

From lib://'connection'/Table1.qvd (qvd)

where table.cust_id =123 and table.cust_name='Abhijit';

qlik4asif
Creator III
Creator III

or You filter first with where condition and then qualify it.

Anonymous
Not applicable
Author

SELECT * FROM TABLE1 ,TABLE2,TABLE3

WHERE

TABLE1.PRODUCT_KEY=TABLE3.PRODUCT_KRY

AND

TABLE2.PRODUCT_PART.NO.=TABLE3.PRODUCT_PART_NO.

AND

( TABLE1.INTP_TYPE  in ('i', 's', 'c')  and TABLE2.PRODUCT _PART_NO<> '20398'

or TABLE1.INTP_TYPE in ('s', 'd')

and TABLE2.PRODUCT_PART_NO.= '20398' );

SO, my question is that, ewhere i will use this filter condition.----

TABLE1.INTP_TYPE  in ('i', 's', 'c')  and TABLE2.PRODUCT _PART_NO<> '20398'

or TABLE1.INTP_TYPE in ('s', 'd')

and TABLE2.PRODUCT_PART_NO.= '20398

Anonymous
Not applicable
Author

SELECT * FROM TABLE1 ,TABLE2,TABLE3

WHERE

TABLE1.PRODUCT_KEY=TABLE3.PRODUCT_KRY

AND

TABLE2.PRODUCT_PART.NO.=TABLE3.PRODUCT_PART_NO.

AND

( TABLE1.INTP_TYPE  in ('i', 's', 'c')  and TABLE2.PRODUCT _PART_NO<> '20398'

or TABLE1.INTP_TYPE in ('s', 'd')

and TABLE2.PRODUCT_PART_NO.= '20398' );


---------this is my script

I am telling you the original scenario:----

Load   PRODUCT_KEY from

table.qvd;


load  PRODUCT_PART_NO, PRODUCT_KEY from

table3.qvd;

Load PRODUCT_PART.NO from

table2.qvd;

Now, where i will use this condition, If , i use this filter condition ----

(TABLE1.INTP_TYPE  in ('i', 's', 'c')  and TABLE2.PRODUCT _PART_NO<> '20398'

or TABLE1.INTP_TYPE in ('s', 'd')

nd TABLE2.PRODUCT_PART_NO.= '20398')


Anonymous
Not applicable
Author

SELECT * FROM TABLE1 ,TABLE2,TABLE3

WHERE

TABLE1.PRODUCT_KEY=TABLE3.PRODUCT_KRY

AND

TABLE2.PRODUCT_PART.NO.=TABLE3.PRODUCT_PART_NO.

AND

( TABLE1.INTP_TYPE  in ('i', 's', 'c')  and TABLE2.PRODUCT _PART_NO<> '20398'

or TABLE1.INTP_TYPE in ('s', 'd')

and TABLE2.PRODUCT_PART_NO.= '20398' );


---------this is my script

I am telling you the original scenario:----

Load   PRODUCT_KEY from

table.qvd;


load  PRODUCT_PART_NO, PRODUCT_KEY from

table3.qvd;

Load PRODUCT_PART.NO from

table2.qvd;

Now, where i will use this condition, If , i use this filter condition ----

(TABLE1.INTP_TYPE  in ('i', 's', 'c')  and TABLE2.PRODUCT _PART_NO<> '20398'

or TABLE1.INTP_TYPE in ('s', 'd')

nd TABLE2.PRODUCT_PART_NO.= '20398')

into sheet, in that tell me the exact field expression?

I have PRODUCT_PART_NO. into my sheet, can i apply this filter expression in this column?