Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all
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.
Have a look at these tutorials, they might help:
thanks for reply but it will not work anymore. because both files should compare and give the result as newly added records.
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;
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:
Regards!