MetaPivot

Not available in Community Designer

Short Description
Ports
Metadata
MetaPivot Attributes
Details
Examples
See also

Short Description

MetaPivot converts every incoming record into several output records, each one representing a single field from the input.

Component Same input metadata Sorted inputs Inputs Outputs Java CTL Auto-propagated metadata
MetaPivot-
no
11
no
no
yes

Icon

Ports

Port typeNumberRequiredDescriptionMetadata
Input0
yes
For input data recordsAny1
Output0
yes
For transformed data recordsAny2

Metadata

MetaPivot does not propagate metadata.

MetaPivot has a metadata template on it's output port.

[Important]Important

When working with MetaPivot, you have to use a fixed format of the output metadata. The metadata fields represent particular data types. Field names and data types have to be set exactly as follows (otherwise unexpected BadDataFormatException will occur):

Field NameTypeDescription
recordNolongthe serial number of a record (outputs can be later grouped by this) - fields of the same record share the same number
fieldNointegerthe current field number: 0...n-1 where n is the number of fields in the input metadata
fieldNamestringname of the field as it appeared on the input
fieldTypestringthe field type, e.g. "string", "date", "decimal"
valueBooleanbooleanthe boolean value of the field
valueBytebytethe byte value of the field
valueDatedatethe date value of the field
valueDecimaldecimalthe decimal value of the field
valueIntegerintegerthe integer value of the field
valueLonglongthe long value of the field
valueNumbernumberthe number value of the field
valueStringstringthe string value of the field

MetaPivot Attributes

MetaPivot has no transformation-affecting attributes.

Details

On its single input port, MetaPivot receives data that do not have to be sorted. Each field of the input record is written as a new line on the output. The metadata represent data types and are restricted to a fixed format, see Details All in all, MetaPivot can be used to effectively transform your records to a neat data-dependent structure.

Unlike Normalizer, which MetaPivot is derived from, no transformation is defined. MetaPivot always does the same transformation: it takes the input records and "rotates them" thus turning input columns to output rows.

The total number of output records produced by MetaPivot equals to (number of input records) * (number of input fields).

You may have noticed some of the fields only make the output look better arranged. That is true - if you needed to omit them for whatever reasons, you can do it. The only three fields that do not have to be included in the output metadata are: recordNo, fieldNo and fieldType.

Examples

Converting Line to List

Convert records with metadata fields username, surname and firstname

doejohn|Doe  |John     
smithel|Smith|Elisabeth
...

into lines having each field value on a separate line:

username |doejohn
surname  |John
firstname|Doe
username |smithel
surname  |Elisabeth
firstname|Smith
...
Solution

Place the component into a graph and connect edges. There is nothing to be set up.

Note: You need Reformat to exclude unnecessary output fields.

See also

Pivot
Common Properties of Components
Specific Attribute Types
Common Properties of Transformers
Transformers Comparison