Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have following two data sets. I need to show compliant and non compliant data sets after comparing them.
Table-1.
Table-2.
Please find the attached file
Try this:
Script:
Raw:
LOAD
"Server IP"&'|'&"Server Name" &'|'& Department as Key,
"Server IP",
"Server Name",
Department,
HasError,
DeviceType
FROM [lib://AttachedFiles/Table Details.xls]
(biff, embedded labels, table is [Table-1$]); //replace filepath with yours
Mapping:
LOAD
"Server IP",
"Server Name",
Department,
"Server IP"&'|'&"Server Name" &'|'& Department as KeyExist
FROM [lib://AttachedFiles/Table Details.xls]
(biff, embedded labels, table is [Table-2$]); //replace filepath with yours
NoConcatenate
Compliant:
load *,'Compliant' as Status resident Raw
where exists(KeyExist,Key);
NonCompliant:
load *,'Non-Compliant' as Status resident Raw
where not exists(KeyExist,Key);
Concatenate
MisMatched:
load *,'MisMatched' as Status resident Mapping
where not exists(Key,KeyExist);
drop table Raw;
drop table Mapping;
exit Script;
Try this:
Script:
Raw:
LOAD
"Server IP"&'|'&"Server Name" &'|'& Department as Key,
"Server IP",
"Server Name",
Department,
HasError,
DeviceType
FROM [lib://AttachedFiles/Table Details.xls]
(biff, embedded labels, table is [Table-1$]); //replace filepath with yours
Mapping:
LOAD
"Server IP",
"Server Name",
Department,
"Server IP"&'|'&"Server Name" &'|'& Department as KeyExist
FROM [lib://AttachedFiles/Table Details.xls]
(biff, embedded labels, table is [Table-2$]); //replace filepath with yours
NoConcatenate
Compliant:
load *,'Compliant' as Status resident Raw
where exists(KeyExist,Key);
NonCompliant:
load *,'Non-Compliant' as Status resident Raw
where not exists(KeyExist,Key);
Concatenate
MisMatched:
load *,'MisMatched' as Status resident Mapping
where not exists(Key,KeyExist);
drop table Raw;
drop table Mapping;
exit Script;
Did Arthur's solution work for your use case? If so, do not forget to return to the post and use the Accept as Solution button on Arthur's post to give him credit for the assistance with things and to let other Community Members know this worked for you. If you are still working on things, leave an update.
Regards,
Brett
@Arthur_Fong Many thanks , It is working .