
We suppose that you have already learned what is described in:
If you want to find the appropriate Transformer for your purpose, see Transformers Comparison.
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 |
|---|---|---|---|---|---|---|
| MetaPivot | - | no | 1 | 1 | no | no |
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 Advanced Description 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 transofmation is defined. MetaPivot always does the same tranformation: it takes the input records and "rotates them" thus turning input columns to output rows.

| Port type | Number | Required | Description | Metadata |
|---|---|---|---|---|
| Input | 0 | yes | For input data records | Any1 |
| Output | 0 | yes | For transformed data records | Any2 |
MetaPivot has no component-specific attributes.
![]() | 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
|
[recordNo long] - the serial number of a record
(outputs can be later grouped by this) - fields of the same record
share the same number (notice in Figure 47.7, Example MetaPivot Output )
[fieldNo integer] - the current field number: 0...n-1 where
n is the number of fields in the input metadata
[fieldName string] - name of the field as it appeared
on the input
[fieldType string] - the field type, e.g. "string",
"date", "decimal"
[valueBoolean boolean] - the boolean value of the field
[valueByte byte] - the byte value of the field
[valueDate date] - the date value of the field
[valueDecimal decimal] - the decimal value of the field
[valueInteger integer] - the integer value of the field
[valueLong long] - the long value of the field
[valueNumber number] - the number value of the field
[valueString string] - the string value of the field
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.
Example 47.4. Example MetaPivot Transformation
Let us now look at what MetaPivot makes to your data. Say you have a delimited file containing data of various data types. You have only two records:
Sending these data to MetaPivot "classifies" the data
to output fields corresponding to their data types:
Thus e.g. "hello" is placed in the valueString field
or "76.70" in valueDecimal.
Since there were 2 records and 9 fields on the input, we have got 18 records
on the output.