Extending it

Electronic reporting

The configurations that turn records into a wire file and a wire file into staging rows. Four per document type, and two of them are bound by agreements.

Electronic Reporting is Microsoft's own mapping tool, and the module uses it as it is rather than wrapping it. If you have built an ER format before, nothing here is new; what is specific is which configuration an agreement binds, and that is the part people get wrong.

Four configurations, two models

ConfigurationWhat it doesBound by
Export formatWrites the wire fileThe outbound agreement, as the format mapping
Export model mappingFeeds that format from the data providerNothing. The format reaches it by model
Import formatParses the arriving wire fileNothing
Import model mappingLands the parsed values as staging rowsThe inbound agreement, as the model mapping

Bindings are record ids

An agreement stores the configuration's record id rather than its name. That is what you want: a configuration can be renamed without breaking the agreements that point at it, and reimporting a configuration keeps the bindings intact.

Working on a format

Two things are worth knowing before your first afternoon with one.

Times are rendered in the user's time zone

A date and time handed to ER is formatted for whoever is running it, which for a batch job is not who you think. If the wire format demands a specific representation, format it in code and hand ER a string. It is the difference between a document that is right and one that is right in Copenhagen.

An empty list is not the same as no list

Reading a repeating element that has no occurrences throws rather than yielding nothing, so an optional group needs a guard on the way in. This is the most common cause of an import that works for every test file and fails on the first real one, because real partners leave optional groups out.

Testing a format without a partner

Both directions can be exercised alone. Post a document and read the file the module produced; drop a file in and watch what lands in staging. That is a complete round trip without involving anyone.

Do that first. A format that is wrong is much easier to see in a file you produced deliberately than in a rejection notice three days later.

Versions

ER configurations version, and only completed versions are used. During development the draft is what you are editing and the completed version is what runs, which is why a change you are sure you made can appear not to have taken effect. Complete the version.

Where the example's configurations live

The example model ships four configurations for its goods received note, over an export model and an import model, and they are worth reading before writing your own. They are small enough to hold in your head and complete enough to copy the shape of.