map
Add new values to your data extract using a mapping table and existing values.
Introduction
Use the map enrichment to add new values to a new column in a data extract. The enrichment looks at values in a given column, then uses these values to map new values into a new column. The map enrichment uses a mapping table to determine what new values to create.
You must create a mapping table before using the map enrichment. For more information, see Creating and applying mapping tables.
Creating the enrichment
For more information on creating an enrichment, see Using custom scripts.
Configuring the enrichment
To configure the enrichment, fill in the following fields. Required fields are marked with an asterisk (*).
-
Sourcefield
-
Enter the name of the column in the data extract that contains the source values. Use regular expressions in the MATCH column of the mapping table to expand the search criteria.
-
Fieldname
-
Enter the name of the new column to be added to the data extract. This new column is populated with the target values.
-
Mapping
-
Enter the name of the mapping table to use in the map enrichment.
-
Missing
-
Select what Adverity does if a value in the data extract is not present in the MATCH column of the mapping table. Select one of the following options:
-
Select ignore to ignore the missing mapping entry and continue with the enrichment process.
-
Select create to create a new entry in the mapping table and continue with the enrichment. The MATCH column of the new entry is populated with the new value found in the data extract that is missing from the mapping table. By default, the VALUE column is left empty. However, you can enter a value in the Alternative field of the instruction which populates the VALUE column when the create feature is used. For example, if a data extract contains a value not present in the mapping table and the Alternative field contains the text
'Match not found'
, then the data in the new column is populated with the text Match not found. -
Select stop to stop the enrichment process. A new column is not created in the data extract and an error message is shown in the datastream overview.
-
Select create,stop to populate the new column with the value from the data extract that is missing from the mapping table and stop the enrichment process.
-
-
Errors
-
To configure Adverity's behavior when an error occurs during the enrichment process, select one of the following:
-
Select ignore to ignore the error and continue the enrichment process.
-
Select raise to notify you about the error and continue the enrichment process.
-
-
Notify
-
Select this checkbox to send notifications to users subscribed to the Datastream and Enrichment Issues and Mapping topics. For more information on setting up notifications, see Setting up notifications. Customize the text in the notifications using the Comment field.
-
Flush Table
-
Select this checkbox to remove all values from a mapping table. Only select Flush Table if a mapping table is to be populated with values from a data extract.
-
If
-
Enter a python expression. The python expression looks at each row in the data extract and if a particular row is evaluated as
TRUE
, then the mapping is applied to that row. -
Comment
-
Enter text to include in the notifications or error messages. The text must be entered as a Python expression. For example, to include the text Cannot find value: [name of value] in Data Extract, enter the following Python expression:
'Cannot find value: %s in Data Extract' %{sourcefield_column_name}
In this example, replace
sourcefield_column_name
with the name of the column in the data extract that contains the source values. You must contain the name of the column within braces{}
. -
Alternative
-
Enter a value to populate the new column of the data extract if a value in the Sourcefield column cannot be matched to a value in the mapping table. The text must be entered as a Python expression. For example, to populate the column with a value of Invalid, enter the Python expression
'Invalid'
.