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

Usage of "exists"

Hello,

I am trying to check if the value of a field (CustomerID) in a table A is in any record of other table B, in the field PartnerID.

I am processing every record in table A. If the value of the CustomerID field can be found in table B, I'll update a field in table A.

I have tried with exists:

if(exists(CustomerID, PartnerID), "Yes","No") as CustomerIsPartner,

but QV cannot find PartnerID.

Should I go this way or can this be achieved with any other command?

Many thanks in advance.

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

I believe all you need to do is swap the field order and use single quotes:

if(exists(PartnerID, CustomerID),'Yes','No') as CustomerIsPartner

View solution in original post

4 Replies
Miguel_Angel_Baeyens

Hello,

You may use

LOAD PartnerID FROM FILE.QVD (qvd) WHERE EXISTS(CustomerID, PartnerID);


So the final table loaded will only contain those records where PartnerID matches with an already existing CustomerID.

Hope this helps!

johnw
Champion III
Champion III

I believe all you need to do is swap the field order and use single quotes:

if(exists(PartnerID, CustomerID),'Yes','No') as CustomerIsPartner

salto
Specialist II
Specialist II
Author

Thank you, I'll have a look at the usage of .qvd files.

salto
Specialist II
Specialist II
Author

Hello,

you were right, the order of the fields was incorrect. It works perfectly now!