Question

Shapefilename with directory


Hello, i have to write esri shapefiles and want to dynamically create directories. So i tried to write something like @Value(outDir)/@Value(outFilename) in the field Shapefilename of the writer. But there is no directory created, the "/" is replaced by a "_". It is the same with "\\".

Is this possible?

Thank you.


3 replies

Userlevel 4

Are you using dataset fanout? Example:

The above example will create and output "test.shp" in subdirectories based on "_creation_instance".

Badge +16

Hi @walgram,

Since a shapefile is a folder based format, the destination parameter points to a folder, the shapefile name is set in the writer feature type.

See the attached demo workspace, where you can dynamically create the destination folder and shapefile name

shapefilename-with-directory.fmw

Userlevel 2
Badge +17

Hi @walgram, a combination of Dataset Fanout and Feature Type Fanout might help you.

Assuming that "outDir" attribute stores the destination folder name and "outFilename" attribute stores your desired Shepefile file name; set the "outDir" to the Fanout Expression parameter of the Shapefile writer, and set the "outFilename" to the Shapefile Name field in the writer feature type. e.g.

See the Workbench Help to learn more about the Fanout mechanism.

FME Workbench | Separating Output Data with Fanout

Reply