MultiLevelReader reads data from flat files with a heterogeneous structure.
|Component||Data source||Input ports||Output ports||Each to all outputs||Different to different outputs||Transformation||Transf. req.||Java||CTL||Auto-propagated metadata|
|Input||0||For port reading. See Reading from Input Port.||One field (|
|Output||0||For correct data records||Any(Out0)|
|1-N||For correct data records||Any(Out1-OutN)|
MultiLevelReader does not propagate metadata.
MultiLevelReader has no metadata template.
Metadata on all output ports can use Autofilling Functions.
source_size functions work only when reading
from a file directly (if the file is an archive or it is stored in
a remote location, timestamp will be empty and size will be 0).
|File URL||yes||Attribute specifying what data source(s) will be read (flat file, input port, dictionary). See Supported File URL Formats for Readers.|
Encoding of records that are read.
The default encoding depends on DEFAULT_CHARSET_DECODER in defaultProperties.
|UTF-8 | <other encodings>|
|Data policy||Determines what should be done when an error occurs. For more information, see Data Policy.||Strict (default) | Lenient|
|Selector code||||Transformation of rows of input data file to data records written in the graph in Java.|
|Selector URL||||The name of an external file, including the path, defining the transformation of rows of input data file to data records written in Java.|
|Selector class||||The name of an external class defining the transformation of rows of input data file to data records.||PrefixMultiLevelSelector (default) | other class|
|Selector properties||The list of the |
|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|
 If you do not define any of these three attributes, the
default Selector class
For more information, see Java Interfaces for MultiLevelReader.
See also Defining Transformations for detailed information about transformations.
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, input port, or dictionary.
Unlike FlatFileReader 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. For more detailed information, see Data Policy.
Consider using a newer ComplexDataReader component if you find some limitation of this component.
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
separated by a 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 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.
Following are the methods of the
int choose(CharBuffer data, DataRecord
A method that peeks into
reads characters until it can either determine metadata of the
record which it reads, and thus return an index to metadata pool
init() method, or runs out of data
Called at the end of selector processing after all input data records were processed.
void init(DataRecordMetadata metadata, Properties
Initializes this selector.
Returns the number of characters needed to decide the (next) record type. Usually it can be any fixed number of characters, but dynamic lookahead size, depending on previous record type, is supported and encouraged whenever possible.
Each call to
choose() can instrument the
parent to skip a certain number of characters before attempting to
parse a record according to metadata returned in
void postProcess(int metadataIndex, DataRecord
In this method, the selector can modify the parsed record before it is sent to a corresponding output port.
This method instruments the selector to find the offset of the next record which is possibly parseable.
Resets this selector completely. This method is called once, before each run of the graph.
Resets the internal state of the selector (if any). This method is called each time a new choice needs to be made.
You can use Public CloverDX API in this component too.
We recommend users to explicitly specify Charset.
|2.2||MultilevelReader is available since 2.2.|