Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
odaher123
Contributor II
Contributor II

Reading two records having a single index

Hello everyone,

The concatenation of a file A and a file B gives the following:

Customer_Code     Customer_Name

123                         Client_ABC

123                         Client_EFG

I wish to keep the first one: (Client_ABC)

How to do ?

Thank you

5 Replies
vinieme12
Champion III
Champion III

So you only want to load records from File B that do not exist in File A ?

Try as below

Load

Customer_Code,

Customer_Name

From FileA;

concatenate

Load

Customer_Code,

Customer_Name

From FileB

WHERE NOT EXISTS(Customer_Code);

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
odaher123
Contributor II
Contributor II
Author

Thank you very much for your help, however you must have identical field names in both tables.

vinieme12
Champion III
Champion III

Can you confirm if my assumption is correct

So you only want to load records from File B that do not exist in File A ?

If not, then on what basis should we exclude a row.


Can you post your script?

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
odaher123
Contributor II
Contributor II
Author

// The 1st File

[Clients_S]:

LOAD

  [Code Client] as Code_Client,

  Client

FROM

(qvd);

Store Clients_S into ;

Drop table Clients_S;

// The 2nd File

Clients_Sellsy:

LOAD

    [Code compte auxiliaire] as Code_Client,

  [Client]

FROM

(txt, codepage is 1252, embedded labels, delimiter is ';', msq);

Store Clients_Sellsy into ;

Drop table Clients_Sellsy;

Clients:

Load *

From

(qvd);

Load *

From

(qvd)

WHERE NOT EXISTS ([Code_Client]);

Store Clients into ;

vinieme12
Champion III
Champion III

Not Necessarily

For your Script

// The 1st File
[Clients_S]:
LOAD
[Code Client] as Code_Client,
Client
FROM (qvd);

 
// The 2nd File
Clients_Sellsy:
 
LOAD
 
[Code compte auxiliaire] as Code_Client,
 
[Client]
 
FROM
(
txt, codepage is 1252, embedded labels, delimiter is ';', msq)
Where Not Exists (Code_Client, [Code compte auxiliaire]);

try below example

Load * inline [
Customer_Code,Customer_Name
123,ABC
546,XYZ
]
;
 
concatenate
 
Load CCode as Customer_Code,Customer_Name inline [
CCode,Customer_Name
123,XYZ 
789,CVB
]

WHERE NOT EXISTS(Customer_Code,CCode);

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.