Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
soniasweety
Master
Master

How to Match and Load

Hi all

Sunny T

I have data with two fields  with text  .  in file 1 :   like below 

'Party and Node    with some rows  .   and i have  new files  with same columns and   data is adding to existing  file  so

i want to match the data and  i want to   create new file with      matching data and    newly added data into   new file.

13 Replies
Not applicable

soniasweety
Master
Master
Author

thanks for reply but it will not work anymore. because  both files should compare and  give the result as newly added records.

qlik_jaijhn
Contributor II
Contributor II

Hi,

I think this following script may fix your issues. There is a new field called "DataType" which can identify your fresh record and the duplicate record.. Please try this, hope it works..  

Data:

LOAD RecNo() AS ID,

  Party&Node AS Key,

  Party,

     Node

FROM

rough.xlsx

(ooxml, embedded labels, table is Sheet1);

LOAD RecNo() AS ID,

  Party&Node AS Key,

  Party,

     Node

FROM

rough.xlsx

(ooxml, embedded labels, table is Sheet2);

LEFT JOIN (Data)

LOAD DISTINCT

ID,

if(Key=previous(Key),peek("Row Number")+1,1) as "Row Number"

RESIDENT Data

ORDER BY Key DESC;

FinalData:

Load *,

If("Row Number"=1,'FreshData','DuplicateData') AS DataType

Resident Data;

Drop Table Data;

Exit SCRIPT;

Anonymous
Not applicable

Hi Song,

Try this:

Old:

LOAD

  Trim(Party) as Party,

  Trim(Node) as Node,

  AutoNumberHash128(Trim(Party)&'-'&Trim(Node)) as Key,

  'Old' as Type

FROM rough.xlsx (ooxml, embedded labels, table is Sheet1);

New:

  LOAD

  Trim(Party) as Party,

  Trim(Node) as Node,

  AutoNumberHash128(Trim(Party)&'-'&Trim(Node)) as Key,

  'New' as Type

FROM rough.xlsx (ooxml, embedded labels, table is Sheet2)

Where Not(Exists('Key',AutoNumberHash128(Trim(Party)&'-'&Trim(Node))));

Output:

Captura.PNG

Regards!