Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
nihhalmca
Specialist II
Specialist II

Exists()

Hi All,

1. QVD has Country field.

2. Country field has values respectively USA, INDIA, JAPAN.

3. I want to extract only USA data by optimized way.

I mean using of where exists(). (Not to use where country = 'USA').

Sample Code:

Country:

Load

  Country   -- it has all countries

From Country.Qvd;

USA:

Load

Country --- expecting here only USA

From Country.qvd where exist ............

Regards,

Nihhal.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

FILTER:

LOAD Country INLINE [

Country

USA

];

LOAD * FROM QVD.qvd (qvd)

WHERE EXISTS(Country);

DROP TABLE FILTER;

View solution in original post

26 Replies
swuehl
MVP
MVP

FILTER:

LOAD Country INLINE [

Country

USA

];

LOAD * FROM QVD.qvd (qvd)

WHERE EXISTS(Country);

DROP TABLE FILTER;

jagan
Partner - Champion III
Partner - Champion III

Hi Nihhal,

Try like this

Temp:

LOAD

*

INLINE [

Country

USA];

Data:

LOAD

*

FROM Datasource

WHERE Exists(Country);

DROP TABLE Temp;

Or you can try Keep

Temp:

LOAD

*

INLINE [

Country

USA];

Data:

Left Keep(Temp)

LOAD

*

FROM Datasource;

DROP TABLE Temp;

MK_QSL
MVP
MVP

Temp:

Load * Inline

[

  Country

  USA

];

Load * From QVDName

Where Exists (Country);

Drop Table Temp;

Alvaro_Palacios
Support
Support

Hi Nihhal,

If the exist() doesn't work using the same field name (Country) as in your datasource then try the following code in your script:

TempTable:

LOAD * INLINE [

CountryTemp

USA

];

YourTable:

LOAD * FROM YourDataSource.qvd (qvd)

WHERE EXISTS(CountryTemp,Country);

DROP TABLE TempTable;

Hope this helps

Alvaro P.

nihhalmca
Specialist II
Specialist II
Author

Hi Jagan,

First requirement - have to do optimized way if i use keep it should be non-optimized.

QVW has QVD with all countries data please see below sample code.

Country:

Load

  Country   -- it has all countries

From Country.Qvd;

USA:

Load

Country --- expecting here only USA

From Country.qvd where exist ............

Regards,

Nihhal.

jsingh71
Partner - Specialist
Partner - Specialist

Country:

Load * Inline [

Country

US ];

Tab:

Load *

Where Exists(Country);

LOAD Name,

     if(isnull(Grade),0,Grade) as Grade,

     Date,

     Country

FROM

Sample.xls

(biff, embedded labels, table is Sheet1$);

nihhalmca
Specialist II
Specialist II
Author

Hi Manish,

As per your code, small change.

suppose your TEMP table has many countries.

nihhalmca
Specialist II
Specialist II
Author

Hi Swuehl,

In my scenario Country has USA, INDIA, JAPAN. However u have taken only USA.

nihhalmca
Specialist II
Specialist II
Author

Hi Alvaro,

In my scenario Country has USA, INDIA, JAPAN. However u have taken only USA