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: 
metalmoney
Contributor
Contributor

Using Where Exist when loading qvs using LIB

Hi everyone,

We use this script for loading a huge dataset in my company.

But I´m trying to create a new app that doesn´t need the whole data, just a part of it, related to an specific product, i.e. = Country= Spain. Product_Type=Shoes.

This is the qvs:

$(Must_Include=lib://Config_PROD/Scripts/Apps/qApp_Cuadro_Comercial_.qvs);

And I would like to load just a part of the data related to the field: Product_Type =  Shoes

I can't find a way to optimize this load. I dont need T-Shirt data, 90% of data are from t-Shirts. I just need the remaning 10% for Shoes.

Thank you, in advance

Labels (3)
4 Replies
ThiagoCN
Contributor III
Contributor III

Tmp_load
Load * Inline
[Product_Type,
Shoes
];

Data:
Load 
* from Your_lib
where exist (Product_Type);


Drop table Tmp_load;


rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

It appears the load statement is in the qvs file. There is no way to inject the where exists unless the qvs file has been written to accept configuration variables -- which is unusual.  An alternative would be to use an inner join to trim the resident table after loading. For example if your loaded table was named "Sales". 

Inner Join (Sales) 
Load * Inline [
Product_Type
Shoes
];

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com

metalmoney
Contributor
Contributor
Author

Thank you all,

Maybe I didn´t explain properly. I´ve found this solution and seems to work Ok for me:

After the $(Must_Include sentence...

RIGTH KEEP

LOAD 'Shoes' as Product_Type

AUTOGENERATE(1);

 

 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

"Inner Join" is a bit better than "Right Keep" for this case, as it won't create an extra table. 

-Rob