MultiLevelReader

Commercial Component

We assume that you have already learned what is described in:

If you want to find the right Reader for your purposes, see Readers Comparison.

Short Summary

MultiLevelReader reads data from flat files with a heterogeneous structure.

Component Data source Input ports Output ports Each to all outputs1) Different to different outputs2) Transformation Transf. req. Java CTL
MultiLevelReaderflat file11-nnoyesyesyesyesno

Legend

1) Component sends each data record to all connected output ports.

2) Component sends different data records to different output ports using return values of the transformation. See Return Values of Transformations for more information.

Abstract

MultiLevelReader reads information from flat files with a heterogeneous and complicated structure (local or remote which are delimited, fixed-length, or mixed). It can also read data from compressed flat files, console, input port, or dictionary.

Unlike CSVReader or the two deprecated readers (DelimitedDataReader and FixLenDataReader), MultiLevelReader can read data from flat files whose structure contains different structures including both delimited and fixed length data records even with different numbers of fields and different data types. It can separate different types of data records and send them through different connected output ports. Input files can also contain non-record data.

Component also uses the Data policy option. See Data Policy for more detailed information.

Icon

Ports

Port typeNumberRequiredDescriptionMetadata
Input0noFor port reading. See Reading from Input Port.One field (byte, cbyte, string).
Output0yesFor correct data recordsAny(Out0)1)
1-NnoFor correct data recordsAny(Out1-OutN)1)

Legend:

1): Metadata on all output ports can use Autofilling Functions.

MultiLevelReader Attributes

AttributeReqDescriptionPossible values
Basic
File URLyesAttribute specifying what data source(s) will be read (flat file, console, input port, dictionary). See Supported File URL Formats for Readers. 
Charset Encoding of records that are read.ISO-8859-1 (default) | <other encodings>
Data policy Determines what should be done when an error occurs. See Data Policy for more information.Strict (default) | Lenient
Selector code1)Transformation of rows of input data file to data records written in the graph in Java. 
Selector URL1)Name of external file, including path, defining the transformation of rows of input data file to data records written in Java. 
Selector class1)Name of external class defining the transformation of rows of input data file to data records.PrefixMultiLevelSelector (default) | other class
Selector properties List of the key=value expressions separated by semicolon when the whole is surrounded by flower brackets. Each value is the number of the port through which data records should be sent out. Each key is a serie of characters from the beginning of the row contained in the flat file that enable differentiate groups of records. 
Advanced
Number of skipped records Number of records to be skipped continuously throughout all source files. See Selecting Input Records.0-N
Max number of records Maximum number of records to be read continuously throughout all source files. See Selecting Input Records.0-N
Number of skipped records per source Number of records to be skipped from each source file. See Selecting Input Records.Same as in Metadata (default) | 0-N
Max number of records per source Maximum number of records to be read from each source file. See Selecting Input Records.0-N

Legend:

1): If you do not define any of these three attributes, the default Selector class (PrefixMultiLevelSelector) will be used.

PrefixMultiLevelSelector class implements MultiLevelSelector interface. The interface methods can be found below.

See Java Interfaces for MultiLevelReader for more information.

See also Defining Transformations for detailed information about transformations.

Advanced Description

Selector Properties

You also need to set some series of parameters that should be used (Selector properties). They map individual types of data records to output ports. All of the properties must have the form of a list of the key=value expressions separated by semicolon. The whole sequence is in curly brackets. To specify these Selector properties, you can use the dialog that opens after clicking the button in this attribute row. By clicking the Plus button in this dialog, you can add new key-value pairs. Then you only need to change both the default name and the default value. Each value must be the number of the port through which data records should be sent out. Each key is a series of characters from the beginning of the row contained in the flat file that enable differentiate groups of records.

Java Interfaces for MultiLevelReader

Following are the methods of the MultiLevelSelector interface: