Multi-Writer Directives (Technical Reference)

The Multi-Writer processes several directives in the underlying mapping file. You will see entries in the Translation Log when you run a workspace. For example:

Using MultiWriter with keyword `MULTI_WRITER' to output data

When writers of different types are explicitly specified, the Multi-Writer is configured with these keywords. These details are visible in the FME Workbench Translation Log pane.

Keyword

Value

MULTI_WRITER_TYPE{key}

Contains the name of the writer to use for features identified by key. Although the key can be any string, it is typically a numeric ID in the range of 0 to N-1, where N is the number of writers being configured.

For applications that require partitioning one dataset into several tiles, the key can be composed of a row,column pair. Although the row and column can be any strings, they are typically numeric, with row in the range of 0 to I-1 and column in the rage of 0 to J-1, where I*J is the number of writers being configured. This configuration is demonstrated in Example 6.

MULTI_WRITER_KEYWORD{key}

Contains the keyword that the writer identified by key looks for when it scans the mapping file for its own settings.

It is important to note that the type or types specified by the MULTI_WRITER_KEYWORD are not valid in the correlation lines because, when using the Multi-Writer, the destination is a logical dataset encapsulated by the Multi-Writer. Thus, the output part of the correlation lines must use MULTI_WRITER, unless the keyword is explicitly reset using the WRITER_KEYWORD command (Example 5 shows how to do this).

When the Multi-Writer is configured to create multiple datasets of the same type, the following keywords are used:

Keyword

Value

MULTI_WRITER_TYPE{*}

Contains the type of the writer to use for all the datasets written to the folder specified by the MULTI_WRITER_DATASET keyword. The asterisk (*) is required, and indicates that the same writer type will be used for all datasets.

MULTI_WRITER_DATASET{*}

Contains the parametrized template used for naming the destination datasets created by the individual writers. The parameters allowed in this template are either <multi_writer_id> or <multi_writer_row> and <multi_writer_column>.

MULTI_WRITER_ID_ATTRIBUTE

Specifies an alternative attribute to use instead of multi_writer_id. This can be useful if you are nesting one Multi-Writer inside of another.

MULTI_WRITER_DATASET_ORDER

Determines ordering of the output datasets. This keyword accept three values:

  • BY_ID: The output dataset ordering will be based on the value of the multi_writer_id attribute. If values of all the multi_writer_id attributes are numeric, then they will be ordered numerically; otherwise they will be ordered alphanumerically. For example, if the IDs are 1,2,3.....10,11,12, they will be ordered numerically; if the IDs are test1,test2,test3, ....test10,test11, test12, they will be ordered alphanumerically (and as a result the output ordering will look like test1, test10, test11, test12, test2,....test9).
  • BY_INPUT: The output dataset ordering will be based on how the datasets were input to the writer. If they were input in certain order, then that order will be maintained during the output.
  • NONE: The output ordering will be random.

MULTI_WRITER_FIRST_WRITER_ID

The multi_writer_id of the first writer. If the value of MULTI_WRITER_DATASET_ORDER keyword is BY_INPUT or NONE then the writer matching this ID will be forced to write the output immediately without caching the features for better performance.

The MULTI_WRITER_KEYWORD is not specified when the MULTI_WRITER_TYPE{*} is used. In this situation, the Multi-Writer makes the keyword for each individual writer the same as the identifier for that same writer. Thus individual writers will scan the mapping file first for their specific keyword and then for the generic one. For example, the following lines:

WRITER_TYPE MULTI_WRITER

MULTI_WRITER_TYPE{*} GIF

GIF_DEF BrightGreen GIF_RED 0 GIF_GREEN 255 GIF_BLUE 0

COLOR_3_DEF BrightGreen GIF_RED 160 GIF_GREEN 128 GIF_BLUE 128

result in the first definition of BrightGreen being used by all the individual writers GIF writers except for the COLOR_3 writer, which will use its own.

Note  When the MULTI_WRITER_TYPE{*} mode is used, the Multi-Writer will attempt to create any folders needed for each individual writer.

The examples illustrate these concepts in detail.