Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Regarding Exist() function and it's functionality

HI,

I need a explanation on exist() function. I had searched and saw the exist function. But am not getting clear view on this. So, can you please clearly explain this.

It would be very helpful to me.

Regards,

Ramana.

13 Replies
jagadeesh_diamo
Contributor III
Contributor III

Can you tell whether you are looking for exit statement or function?

Not applicable
Author

HI Sir,

I need exist() function

where exist() and where not exist()...I need a clear view on this..

SunilChauhan
Champion
Champion

below for where Exists

Table1:

Load * inline [

column1

a

b

c

d

];

Table2:

Load * inline [

column2

a

b

] where Exists(column1,column2);

drop table Table1;

Sunil Chauhan
SunilChauhan
Champion
Champion

below code for not exist

Table1:

Load * inline [

column1

a

b

c

d

];

Table2:

Load * inline [

column2

a

b

e

f

] where not Exists(column1,column2);

drop table Table1;

let me know if any Q's

Sunil Chauhan
its_anandrjs

Hi,

Assume this example for Exists

LOAD * Inline [

ITEM,classes

1

2

12

14 ];

LOAD * Inline [

ITEMID,class

1

2

3

0

10

11

12  ] Where Exists(ITEM,ITEMID);

Means in ItemId you get only that id which match in the Item field

You Get in

Where Exists.png

And for Where NOT Exists

LOAD * Inline  [

ITEM,classes

1

2

12

14  ];

LOAD * Inline  [

ITEMID,class

1

2

3

0

10

11

12 ] Where Not Exists(ITEM,ITEMID);

And difference you get

Where Not Exists.png

Means in ItemId you get only that id which not match in the Item field

Regards

Anand

SunilChauhan
Champion
Champion

@ Anand,

in both cases of yours its need to drop first table then only we could find record which exists and not exists from first table

other wise it will give you all record in first table and existing record from second and

all record in first table and not existing record from second

hope this make sense

Sunil Chauhan
Not applicable
Author

Thank you now i got clarity....

SunilChauhan
Champion
Champion

Mark it correct or helpful for suitable answer .so that post  is closed.

Sunil Chauhan
its_anandrjs

Sunil,

Thats right intentionally i not drop the table for get values of the first and then second table to get values. But for final result we need to drop the Table one at the end of the table load for both case like.

T1:

LOAD * Inline [

ITEM,classes

1

2

12

14 ];

T2:

LOAD * Inline [

ITEMID,class

1

2

3

0

10

11

12  ] Where Exists(ITEM,ITEMID);

Drop Table T1;

Regards

Anand