Solved

Combine two CSV table based on matching feature

  • 20 December 2016
  • 7 replies
  • 2 views

Hello All,

FME Newby here. I have two separate csv tables with one matching column. The tables correspond to a hierarchical network and are filled with their ID's. Please take a look at the network image below.

CP's are always connected to TX's. Some TX's but not all, have upstream DTECH's.

I already have traced which CP connects to which corresponding upstream TX. I have separately traced which TX connects to which DTECH or if they are connected at all to any. I need to merge these two table as one. Please see the example image below.

I tried FeatureMerger matching TX_ID across both tables, but the duplicate TX_ID's are dropped. Any help would be greatly appreciated in this case thanks!

icon

Best answer by erik_jan 20 December 2016, 17:08

View original

7 replies

Userlevel 2
Badge +12

The FeaureMerger is the right way to go, but you need to set "process duplicate suppliers" to Yes. Then add a list name. After the FeatureMerger you explode the list (ListExploder) to get the shown result.

The FeaureMerger is the right way to go, but you need to set "process duplicate suppliers" to Yes. Then add a list name. After the FeatureMerger you explode the list (ListExploder) to get the shown result.

Hi @erik_jan

 

Thanks for the answer. Do I take both Merger and NotMerged and explode the list?
Userlevel 2
Badge +12
Hi @erik_jan

 

Thanks for the answer. Do I take both Merger and NotMerged and explode the list?
Not Merged will only be those records from table 1 that have no matching TX_ID in table 2. In your example that will be no records.

 

 

Not Merged will only be those records from table 1 that have no matching TX_ID in table 2. In your example that will be no records.

 

 

My bad. I should have explained that even that case could happen. I want to export all the records from both tables regardless of match

 

 

Userlevel 2
Badge +12
My bad. I should have explained that even that case could happen. I want to export all the records from both tables regardless of match

 

 

In that case: Lead the Merged to the ListExploder and bypass the ListExploder from the NotMerged (as no list will be created).

 

 

The FeaureMerger is the right way to go, but you need to set "process duplicate suppliers" to Yes. Then add a list name. After the FeatureMerger you explode the list (ListExploder) to get the shown result.

This works great! Thanks

 

 

Userlevel 4
Badge +13
This works great! Thanks

 

 

You may also have gotten results more easily by flipping which was the Supplier and which was the Requestor. I think if "Table 1" was the Requestor and "Table 2" the supplier, you'd just get what you want without any need for lists...but I'm not 100% sure without trying. But worth being aware of that option when dealing with FeatureMerger.

 

 

Aside: We are working on a "FeatureJoiner" that will do Inner/Outer joins so that our Database educated friends will easily be able to spot solutions to problems like this in the future. Until FME 2018, though, FeatureMerger is the only show in town.

 

 

Reply