Skip to main content
I have three writers (CSV, Shape, MITAB) that I want to output to the same directory.

 

 

However, I want that directory to be specified within the workspace at runtime based on the fme_basename of the input.

 

 

So for example:

 

Inputs:

 

  random_dataset_1.csv

 

  random_dataset_2.xls

 

 

Outputs:

 

  c:\\outputs\\random_dataset_1\\bad_data.shp

 

  c:\\outputs\\random_dataset_1\\bad_data.TAB

 

  c:\\outputs\\random_dataset_1\\bad_data.csv

 

 

  c:\\outputs\\random_dataset_2\\bad_data.shp

 

  c:\\outputs\\random_dataset_2\\bad_data.TAB

 

  c:\\outputs\\random_dataset_2\\bad_data.csv

 

 

How can I do this? There isn't a "parameterWriter". I think I saw someone about using special fme_ attributes, but I can't recall what nor find them.

 

Thanks.
Hi jonathan,

 

 

take a look at Dataset Fanout, it will split your output based on an attribute. You could either use fme_basename or use any other attribute that you create yourself.

 

 

David
Thanks David,

 

I already know about "fanout by attribute" but that doesn't do it.

 

 

I already know about them but I'm afraid that won't do it because File and Directory features get treated differently

 

CSV is file based, the other two are directory based.

 

 

Thus I'd prefer to explicitly set the directory once and all three could use it. I just don't know how to pass a directory to an output as an attribute.

 

 

Although that page doesn't actually say how to do dataset fanouts, so I can't test it anyway (seems like quite an omission). But I'm fairly sure its not what I want.
Hi again,

 

 

please note that there is an important distinction between Attribute and Dataset fanout.

 

 

Concerning the differences between file and directory based datasets, you will have to create two different fanout values depending on this type.

 

 

Here is a quick example I made that shows how to use fanout dataset to push shapefiles to different directories depending on an input attribute:

 

 

 

(scroll to the right to see all of it)

 

 

It is a very flexible solution that adapts well to most scenarios with a little bit of creativity 🙂 Hopefully you get the idea.

 

 

David
Hi,

 

 

Maybe the filename part extractor might help you to produce the value on which to fan out.

 

Hope this helps
Thanks Both.

 

 

David - I've somehow always managed to miss the "fanout" option in advanced (despite seeing it plenty of times). That did the trick. Didn't actually need the String Concatenator - that just broke things.

 

 

Set the "Fanout Directory" to

 

c:\\outputs\\

 

 

"attribute to fanout" to a _feature_type

 

That did it fine.

 

Cheers!

Reply