Skip to main content

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

 

 

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

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

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)


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

 


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!

Thanks! Worked like a dream! :)


Reply