Skip to main content
Solved

Merge and Flag

  • January 22, 2014
  • 5 replies
  • 25 views

Forum|alt.badge.img
I need to merge two files (excel).

 

I want to retain the common fields, but I want to remove duplicates, but also flag the data sources.

 

 

So for Example I have:

 

 

Readers

 

File A

 

Name, Postcode, DOB

 

Bob, NG1 1AA, 01/01/1970

 

 

File B

 

Name, Postcode, DOB

 

John, SW1 1AA, 01/01/1980

 

 

Writers

 

File C

 

Name, Postcode, DOB, FileAFlag, FileBFlag

 

Bob, NG1 1AA, 01/01/1970, Yes, No

 

John, SW1 1AA, 01/01/1980, No, Yes

 

 

I can merge the File A and B , simply by using 2 AttributeCreators and 1 AttributeKeeper and a Writer. 

 

 

------------------------------------------

 

 

The problem starts where I have duplicate entries and want to merge the data. See below:

 

 

Readers

 

File A

 

Name, Postcode, DOB

 

Bob, NG1 1AA, 01/01/1970

 

 

File B

 

Name, Postcode, DOB

 

Bob, NG1 1AA, 01/01/1970

 

 

Writers

 

File C

 

Name, Postcode, DOB, FileAFlag, FileBFlag

 

Bob, NG1 1AA, 01/01/1970, Yes, Yes

 

 

-------------------------------------------

 

 

Anyone know which transformers I need to use for this situation?

 

 

Thanks, S.

 

 

 

 

 

 

 

 

Best answer by ebygomm

If you wanted to keep the FileAFlag, FileBFlag structure you can use a featuremerger after your attributecreators and connect the Merged, Not Merged & Unreferenced ports to the writer.
View original
Did this help you find an answer to your question?
This post is closed to further activity.
It may be a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • January 22, 2014
I would expose the fme_basename on the readers.

 

 

Use a matcher to route all unmatched features to the writer

 

Route the matched features to a duplicate remover and then change the fme_basename attribute to read A&B before connecting to the writer.

Forum|alt.badge.img
  • Author
  • January 22, 2014
Hi EGomm, thanks for the feedback.

 

 

Not sure I follow the bit where you say I need to change the fme_basename attribute to read A&B before connecting to the writer.

 

 

 


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • January 22, 2014
Instead of having an attribute named FileAFlag and another named FileBFlag I would have one attribute of fme_basename, this would be set to the filename of the file the feature had come from.

 

 

So if File A is

 

Name Postcode DOB Bob NG1 1AA 01/01/1970 Sue NG15 7SG 01/05/1980

 

 

and File B is

 

 

Name Postcode DOB Bob NG1 1AA 01/01/1970 John SW1 1aa 01/01/1980

 

 

the features being written would be

 

 

Name, Postcode, DOB, fme_basename

 

Sue, NG15 7SG, 01/05/1980, File A

 

John, SW1 1AA, 01/01/1980, File B

 

Bob, NG1 1AA, 01/01/1970, File A & B

 

 


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • Best Answer
  • January 22, 2014
If you wanted to keep the FileAFlag, FileBFlag structure you can use a featuremerger after your attributecreators and connect the Merged, Not Merged & Unreferenced ports to the writer.

Forum|alt.badge.img
  • Author
  • January 22, 2014
That is Magic. Looks to have done the trick.

 

 

I will test it out with a full set of data tomorrow and see if it works. Cheers, S.

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings