Skip to main content Skip to complementary content

ApplyMap - script function

This script function is used for mapping any expression to a previously loaded mapping table.

Syntax:  

ApplyMap('mapname', expr [ , defaultexpr ] )

Arguments:  

Argument Description
mapname 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.
expr The expression, the result of which should be mapped.
defaultexpr An optional expression which will be used as a default mapping value if the mapping table does not contain a matching value for expr. If no default value is given, the value of expr will be returned as is.

Example:  

// Assume the following mapping table:

map1:

mapping LOAD * inline [

x, y

1, one

2, two

3, three ] ;

 

ApplyMap ('map1', 2 ) returns ' two'

ApplyMap ('map1', 4 ) returns 4

ApplyMap ('map1', 5, 'xxx') returns 'xxx'

ApplyMap ('map1', 1, 'xxx') returns 'one'

ApplyMap ('map1', 5, null( ) ) returns NULL

ApplyMap ('map1', 3, null( ) ) returns 'three'

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!