Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
rubenfasilva
Contributor
Contributor

Compare Data Between 2 files

Hello guys!

I am trying to compare data between 2 files, but I can only obtain results if I use Inner Join on tmap.

Imagine that I have 2 files with the following data:

File A:

Referece;code;qty

XPTO;A;1

XPTO;B;2

XPTO;C;1

XPTI;D;1

XPTI;E;2

XPTI;F;1

File B:

Referece;code;qty

XPTO;A;1

XPTO;B;3

XPTO;C;1

XPTI;D;1

XPTI;E;2

XPTI;F;1

Expected Result:

Referece;code;result

XPTO;A;0

XPTO;B;-1

XPTO;C;1

XPTO;D;1

XPTI;B;-1

XPTI;E;0

XPTI;G;1

XPTI;F;1

XPTI;D;1

I want to have a result with all lines from both files...

Is that an easy way to make this happen?

Thank you!

Labels (3)
6 Replies
manodwhb
Creator III
Creator III

@Ruben Silva​ ,use tMap and do the join on Refference and code and then do qty -lookup qty in the output filed of qty, you will get the required output.

 

Thanks,

Manohar

rubenfasilva
Contributor
Contributor
Author

0695b00000G5IdPAAV.png0695b00000G5IcMAAV.pngHello.

That's what I did....but if I join for code and reference the result is only for columns that matches the same values....

 

gjeremy1617088143
Creator III
Creator III

Hi, you can do inner join on reference code and qty. and set MAtch Model to Unique match.

then you make a second output exactly the same as the first one with the same connection in the tmap and in his Property you set Catch lookup inner join reject to true.

So after that you'lhave two output one for the match one for the non match.

Send me Love and Kudos

rubenfasilva
Contributor
Contributor
Author

Hello again.

I did that, but the result it's not what I need....

I know that this can that that easy, but I am really not getting into it....0695b00000G5JRUAA3.png0695b00000G5JRKAA3.png0695b00000G5JR5AAN.png

gjeremy1617088143
Creator III
Creator III

so the inner join just have to be with reference and code.

it wil check in the file B the row wich have the same reference and code as file A and you can do the substract between qty .

rubenfasilva
Contributor
Contributor
Author

Hello!

Thank you for your help, but we still not getting there....

What I have now is:

  • 1st Step is from file A to File B (lookup on tmap) with inner join with unique match (That give me the true results from both files.
  • 2nd Step is again from file A to file B (lookup on tmap) with inner join with unique match with Catch lookup inner join reject

 

0695b00000G5Ut0AAF.pngI am still missing some results from B file....