Formatters

Like extended actions, formatters can be used to extend the basic functionality of Data Management. Where you can use extended actions to execute specific methods, you can use formatters to define more detailed logic.

A formatter is a piece of code that is executed either before or after the data in an import file is mapped to the business objects. There are two general types of formatters: field formatters and data formatters.

Field formatters operate on specific values in the data import. Field formatters are based on the IFieldFormatter interface, which has two methods for import processing: BeforeMapFrom and AfterMapFrom.

Data formatters operate either on steps in an import mapping file, or on the whole document. Data formatters are based on the IDataFormatter interface, which has four methods for import processing. BeforeMapObjectFrom and AfterMapObjectFrom act on a given step, while BeforeMapDocumentFrom and AfterMapDocumentFrom act on the whole document.

A skeleton formatter project can be found in the Reference Guide in the CodeSamples\Code\DataManagement\FormatterExtension directory. The project includes instructions for compiling your formatters and adding monikers to the Monikers configuration in the Configuration Editor.

After you’ve created a formatter and added it to the Monikers configuration, you can add it to the mapping file.

<Formatters>
   <Formatter
    Moniker="Hansen.Core.Messaging.Mapping.Components.Formatters.
    ExampleDataFormatter" />
</Formatters>