////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////
:documentationPath: /pipeline/transforms/
:language: en_US
:description: The Value Mapper transform maps string values from one value to another.

= image:transforms/icons/valuemapper.svg[Value Mapper transform Icon, role="image-doc-icon"] Value Mapper

[%noheader,cols="3a,1a", role="table-no-borders" ]
|===
|
== Description

The Value Mapper transform maps string values from one value to another.

Mapping is usually solved by storing the conversion table in a database.

The Value Mapper provides you with a simple alternative.

For example, if you want to replace language codes:

[source,bash]
----
Fieldname to use: LanguageCode
Target fieldname: LanguageDesc
Source/Target: EN/English, FR/French, NL/Dutch, ES/Spanish, DE/German, ...
----

|
== Supported Engines
[%noheader,cols="2,1a",frame=none, role="table-supported-engines"]
!===
!Hop Engine! image:check_mark.svg[Supported, 24]
!Spark! image:question_mark.svg[Maybe Supported, 24]
!Flink! image:question_mark.svg[Maybe Supported, 24]
!Dataflow! image:question_mark.svg[Maybe Supported, 24]
!===
|===

== Options

The following properties are used to define the mappings:

[options="header"]
|===
|Option|Description
|Transform Name|Name of the transform this name has to be unique in a single pipeline.
|Fieldname to use|Field to use as the mapping source
|Target field name|Field to use as the mapping Target
|Default upon non-matching|Defines a default value for situations where the source value is not empty, but there is no match
|Field values table|Contains the mapping of source value to converted target value.
|===

TIP: If there is an empty source value defined, we map null or empty string to the target value. Only one empty mapping is allowed.
