Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

odaher123
New 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

Tags (2)
5 Replies
vinieme12
Esteemed Contributor II

Re: Reading two records having a single index

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);

odaher123
New Contributor II

Re: Reading two records having a single index

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

vinieme12
Esteemed Contributor II

Re: Reading two records having a single index

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?

odaher123
New Contributor II

Re: Reading two records having a single index

// 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
Esteemed Contributor II

Re: Reading two records having a single index

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);