Generic (Any Format) Reader/Writer

The Generic Reader/Writer allows FME to dynamically read from, or reroute output to, any FME-supported format when a translation is run.

  • The name of the true reader is supplied as an argument to the Generic Reader.
  • The name of the true writer is supplied as an argument to the Generic Reader/Writer.

Overview

  • Generic Reader: Allows translations and transformations to be completely specified, independent of input format. This is useful for solving problems when the input format is not known at design time.
  • Generic Writer: Allows translations and transformations to be completely specified, independent of input or output format. This is useful for solving problems where the input format is known at design time, but the output format is not.

For more information, see Safe Software's blog post about dynamic workspaces.

Reader Overview

The Generic reader acts as a wrapper for the true reader which will be used when the translation is done. At run-time, once the actual reader is known, the Generic reader will do its best to represent the intention of the translation in the chosen input format.

The Generic reader takes a file or multiple files, folder, URL, or database name as the input dataset. If the format that is ultimately targeted requires an input folder, the Generic reader will turn the input filename into a folder by removing the file name part of the path.

The Generic reader simply reads the features using the underlying reader whose name is given by the Input Format parameter.

Adding a Reader as a Resource

If you add a reader as resource, configuring the reader's parameters as desired, the Generic reader will use it to define the schema.

For example when reading a Excel file, FME will not automatically expose the attributes when read with the Generic Reader. However, if you add an Excel Reader as a Resource and specifies the desired parameters, then the attributes will be exposed when the Generic Reader reads.

For more information, see Tips for Using the Generic Reader.

Writer Overview

The Generic writer acts as a wrapper for the true writer which will be used when the translation is done. The Generic writer simply takes any features it was given and routes them to the desired writer, whose name is given by the Output Format parameter.

The Generic writer is most useful for specifying translations which will ultimately target file- or folder-based outputs – it is not useful for targeting databases such as Oracle for output, because it is better to specifically design a translation to target the desired (and likely preexisting) schema for the database system.

When a translation is being authored, the Generic writer will make available all possible geometry and attribute types. At run-time, once the actual writer is known, the Generic writer will do its best to represent the intention of the translation in the chosen output format.

Since not all writers have all capabilities, there may be errors (if, for example, vector features are sent to a raster format), or adjustments (for example, it may truncate attribute names, if the attribute name exceeds an output format's character limit). For this reason, authors using the Generic writer may wish to limit the selection of output formats that they will choose to support in their workspace, and use documentation or other usage notes to convey these restrictions to end users.

The Generic writer always takes a folder as its output dataset. If the format that is ultimately targeted requires an output filename, the Generic writer will turn the output folder into a filename by combining the last portion of the folder name with a file extension. The Generic writer will typically choose the most common file extension for the output format, as read from the FME formats database. For example, if at run-time the Generic writer was given an output dataset of c:/data/roads and was set to write to AutoCAD, then it would pass an output dataset of c:/data/roads/roads.dwg to the AutoCAD writer that it would employ to do the actual writing.

It is possible to make the Generic writer choose a different extension for an output filename by specifying it in the dataset of a format-specific writer. See Tips for Using the Generic Writer.

If the output format targets a folder, the folder given to the Generic writer is used as the ultimate output folder.

Published Workspaces and ParameterFetcher Transformer

The format that the workspace will read from, or write to, can be (and is by default) published.

Workspace authors who want to set up specific data flows for a particular format can use the ParameterFetcher transformer to retrieve the name of the format that actually is being read from, or written to. The value can be defined in the transformer to route features to other transformers.

FME Community