Skip to main content

Handling multiple data sources

Maps that read from one source (typically a file or the payload of a message) and write to one result generally do not have to have any I/O expressions at all. They simply read and write from the documents that are given at map execution times.

You use I/O expressions only if you need to process multiple input or output documents or objects in a single map, you want to "wire in" the URL of documents in the map, or you want to handle differing representations (e.g., flat embedded in XML) within a map.

You can use I/O expressions to do the following:
  • Read and write from/to multiple data sources (files, objects, or messages) in a single map.

  • Specify the location of data to be read/written within a map, for example, specifying the name or URL of a file.

  • Switch to another representation within a single map.

A map is composed of exactly one input structure and one output structure, although these structures may incorporate other structures using the structure inheritance mechanism. By default (in the absence of the explicit use of I/O expressions), when a map is executed, the source data is specified and the output result is specified. For example, when you test run a map, you specify a source document. and the result is displayed in a window or to the test output document.

I/O expressions are allowed only in elements that inherit from structures, so each document instance corresponds to a single structure (which can inherit from multiple other structures).

The I/O expression is processed only for the element on which it is declared. When that element is finished, processing reverts to the I/O expression of its nearest enclosing ancestor. This means that you could process different subordinate document instances inside of a single outer document instance, continuing to process the outer document instance in between the subordinate instances.

Using I/O expressions allows you to have multiple sources (that is, read from multiple files) or produce multiple results in the execution of a map. To specify an I/O expression, drag a Read or Write function (such as ReadURL) to the I/O expression panel. When you specify an I/O expression on an input map element, that map element and all of its children will be read using the specified Read function. When you specify an I/O expression on an output map element, that map element and all of its children will be written using the specified Write function.

If you specify any I/O expressions for a side (input or output) of a map, all of the I/O associated with the map is done through those expression(s), and any elements not encompassed by an I/O expression will not be read or written.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!