Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Compare two files (not based on Record ID)

Empower49
8 - Asteroid

Hello. I have two files with the structure as below and would like to compare the records with the same ID, color, state and size and determine differences in the remaining fields. I can't compare based on record ID, but want to compare based on the first four fields of the record. Does anyone have advice? Thank you! 

 

 

File 1           
IDColorStateSizeAnimal/MammalGeographyRPSCar/truck    
47393GreenFLSPikaIslandRockCar    
47393GreenFLSBobcatMountainPaperTruck    
47393GreenCOMDolphinIslandScissorsCar    
47393PurpleCOMDolphinPrairieRockTruck    
47393PurpleCOMBobcatIslandPaperTruck    
47393PurpleFLLPikaIslandScissorsCar    
47393PurpleFLLMarmotMountainRockCar    
47393RedIDMMarmotMountainPaperCar    
47393RedIDMBobcatMountainScissorsTruck    
47393RedCOSDolphinIslandRockTruck    
47393RedFLLDolphinPrairiePaperCar    
47393RedFLLDolphinPrairieScissorsCar    
            
            
            
            
            
File 2           
IDColorStateSizeAnimal/MammalGeographyRPSCar/truck    
47393GreenFLSPikaPrairieRockTruck    
47393GreenFLSPikaMountainRockCar    
47393GreenCOMDolphinIslandScissorsCar    
47393PurpleCOMDolphinPrairieScissorsTruck    
47393PurpleCOMDolphinIslandPaperTruck    
47393PurpleFLLPikaIslandScissorsCar    
47393PurpleFLLMarmotMountainRockCar    
47393RedIDMMarmotMountainScissorsCar    
47393RedIDMMarmotMountainScissorsCar    
47393RedFLLDolphinPrairiePaperCar    
47393RedFLLDolphinPrairieScissorsTruck    
47393RedCOSPikaPrairieScissorsCar    
            
            
            
Desired Output          
            
IDColorStateSizeAnimal/Mammal 1Animal/Mammal 2File 1 GeographyFile 2 GeographyRPS 1RPS2File 1 Car/TruckFile 1 Car/Truck
47393GreenFLS  IslandPrairie  CarTruck
47393RedCOSDolphinPikaIslandPrairieRockScisscorsTruckCar
5 REPLIES 5
JReid
9 - Comet

You could join on those four fields and then use a filter tool with the custom code

[Animal/Mammal] != [Right_Animal/Mammal] OR
[Geography] != [Right_Geography] OR
[RPS] != [Right_RPS] OR
[Car/truck] != [Right_Car/truck]

 

Empower49
8 - Asteroid

Thank you JReid! I think this is close... the "false" filter is returning the correct records, but the "true" filter is returning all records. I would like the output to only include the mismatches, not all of the data. Do you have any advice? Thank you!

benakesh
12 - Quasar

You can connect  False anchor to down stream tool    or   

add   not  to  expression  i.e not ( expression ) 

 

 

 

 

rafalolbert
ACE Emeritus
ACE Emeritus

Hi @Empower49,

 

This should work:

 

- join on all 4 common fields

- retain the J output

- using Filter tool identify records where at least one remaining fields are mismatched

- for each remaining fields reset both sides to Null if they match and retain values if they don't

 

img1.JPG

 

Thanks,

Rafal

 

#Excuse me, do you speak Alteryx?

Empower49
8 - Asteroid
Thank you very much Rafalolbert! This is exactly what I need. I really appreciate you sharing your expertise - thanks for taking time to post a solution. I look forward to doing the same with the community in the future.
Labels