ApplyMap - script function
The ApplyMap script function is used for mapping any expression to a previously loaded mapping table.
Syntax:
ApplyMap('map_name', expression [ , default_mapping ] )
Arguments:
Argument | Description |
---|---|
map_name | 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. |
expression | The expression, the result of which should be mapped. |
default_mapping |
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. |
Example:
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 looks like this:
Salesperson | Country |
---|---|
John | Sweden |
Mary | Sweden |
Per | Sweden |
Preben | Denmark |
Olle | Denmark |
Ole | Norway |
Risttu | Rest of the world |
Learn more
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!