ApplyMap - script function
The ApplyMap script function is used for mapping the output of an expression to a previously loaded mapping table.
ApplyMap('map_name', expression [ , default_mapping ] )
Return data type: dual
The name of a mapping table that has previously been created through the mapping load or the mapping select statement. Its name must be enclosed by single, straight quotation marks.
Warning noteIf you use this function in a macro expanded variable and refer to a mapping table that does not exist, the function call fails and a field is not created.
|expression||The expression, the result of which should be mapped.|
If stated, this value will be used as a default value if the mapping table does not contain a matching value for expression. If not stated, the value of expression will be returned as is.
In this example we load a list of salespersons with a country code representing their country of residence. We use a table mapping a country code to a country to replace the country code with the country name. Only three countries are defined in the mapping table, other country codes are mapped to 'Rest of the world'.
The resulting table (Salespersons) looks like this:
|Risttu||Rest of the world|