Fixed value

<< Click to Display Table of Contents >>

ETL > 14.0 > Implementation Guide > Tutorial and implementation guide > Steps > Mapping 

Fixed value

You can use a fixed value for a column (for example a string, number or boolean).

To do this, use the following syntax:

{

    "columns": {

        "target_column_name": 

        {

            "value": "some value"

        },
        [...]            

    }

}

 

papercliper

Note:

Avoid mistakes of mixing this syntax with a similar looking "target_column_name": "source_column_name". The former will use a fixed value "source_column_name", the latter will try to look-up the column named "source_column_name".

 

Example

Given the following table SourceTable:

Name

Surname

Age

Marcin

Otorowski

34

John

Smith

51

Kate

Binks

25

 
And the following JSON step definition:

    {

      "id": 1,

      "type""map",

      "name""Example of fixed-columns",

      "source""SourceTable",

      "columns": {

        "Name""Name",

        "Fixed_String": { "value""MyValue" },

        "Fixed_Number": { "value": 23 },

        "Fixed_Boolean": { "value"true }

      },

      "target""TargetTable_FixedColumns"

    }

 

The following result table TargetTable_FixedColumns is expected:

Name

Fixed_String

Fixed_Number

Fixed_Boolean

Marcin

MyValue

23

1 (bit)

John

MyValue

23

1 (bit)

Kate

MyValue

23

1 (bit)

 

Arbitrary types, casting and converting

Using the type property lets you define a custom cast or custom type length. This common property is available for all column types, see more information in chapter Arbitrary column types.