Skip to main content
Best Answer

Write files from attributes - Fanout does not do the trick

  • May 11, 2020
  • 5 replies
  • 41 views

aron
Enthusiast
Forum|alt.badge.img+16

I have a dataset where want to write separate files based on multiple attributes. From the example below I would like to write a file with all the Jones, another with all the Smith, a third with all the Farmer and a fourth with any Kim. Fanout does not handle multiple attributes and in this case the StringConcatenator trick wont help, since most of the rows would be contributing to separate files.

Any ideas on how I can achieve this?

 

A

 

B

 

C

 

D

 

Jones

 

 

Farmer

 

Kim

 

Jones

 

Smith

 

 

 

Jones

 

Smith

 

Farmer

 

 

Best answer by takashi

Hi @aron, if I understand your requirement correctly, this workflow does the trick.

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, 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

takashi
Celebrity
  • May 11, 2020

In the case, do you want to create these three files?

  1. Jones-Farmer-Kim
  2. Jones-Smith
  3. Jones-Smith-Farmer

aron
Enthusiast
Forum|alt.badge.img+16
  • Author
  • Enthusiast
  • May 11, 2020

In the case, do you want to create these three files?

  1. Jones-Farmer-Kim
  2. Jones-Smith
  3. Jones-Smith-Farmer

No, I want to create these four files: :)

1. Jones (With features from rows 1-3)

2. Smith (With features from rows 2-3)

3. Farmer (With features from rows 1 and 3)

4. Kim (With features from row 1)


takashi
Celebrity
  • Best Answer
  • May 11, 2020

Hi @aron, if I understand your requirement correctly, this workflow does the trick.

 


bwn
Evangelist
Forum|alt.badge.img+26
  • Evangelist
  • May 11, 2020

Hi @aron, if I understand your requirement correctly, this workflow does the trick.

 

To add to @takashi 's great idea, may achieve faster execution by replacing the Tester with an AttributeFilter, set to Filter "_fanout_attribute" values. The <Unfiltered> Output Port will have the same values as the Tester above.

This is because AttributeFilter builds an Attribute index and also is Bulk Mode Enabled so generally works faster than the equivalent Tester.

  • In my test FME 2018 workspace with 1,000,000 Features with AttributeCopier->Tester. Takes 26 seconds.
  • With the same workspace with AttributeCopier->AttributeFilter. Takes 0.4 seconds!

aron
Enthusiast
Forum|alt.badge.img+16
  • Author
  • Enthusiast
  • May 11, 2020

Thanks! Worked like a dream! :)