Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

can anyone explain the mapping() and applymap()

can anyone explain the mapping() and apply-map()

3 Replies
MK_QSL
MVP
MVP

maxgro
MVP
MVP

QlikView has a good help

Mapping Functions

The ApplyMap function is used for mapping any expression to a previously loaded mapping table. The syntax is:

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

where:

mapname is the name of a mapping table that has previously been created through the mapping load or the mapping select statement (see Mapping). Its name must be enclosed by single, straight Quotation Marks in Scripting.

expr is the expression, the result of which should be mapped.

defaultexpr is 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.

Examples:

// 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'

The MapSubstring function is used to map parts of any expression to a previously loaded mapping table. The mapping is case sensitive and non-iterative and substrings are mapped from left to right. The syntax is:

mapsubstring('mapname', expr)

This function can be used for mapping parts of any expression on a previously loaded mapping table. The mapping is case sensitive and non-recursive. The substrings are mapped from the left to the right. Mapname is the name of a mapping table previously read by a mapping load or a mapping select statement (see Mapping). The name must be enclosed by single straight quotation marks. Expr is the expression whose result should be mapped by substrings.

Examples:

// Assume the following mapping table:

map1:

mapping load * inline [

x, y

1, <one>

aa, XYZ

x, b ] ;

MapSubstring ('map1', 'A123') returns 'A<one>23'

MapSubstring ('map1', 'baaar') returns 'bXYZar'

MapSubstring ('map1', 'xaa1') returns 'bXYZ<one>'

QlikView 11.20 SR10

prabhas277
Creator
Creator

Hi,

Mapping Load:

Mapping Tables are used in qlikview cleanup the data model

Table with just 2 columns can be removed and columns of that table can be mapped to another table

Mapping tables are stored in separate area in memory and used only as mapping tables during the script execution.After script execution they will be automatically dropped.

Apply map syntax:

Apply map('Table name',fieldname) as Newfield.

ex:

Shippers:

Mapping

LOAD 

      CompanyName,

      ShipperID;

SQL SELECT *

FROM Shippers;

Shipments:

LOAD CustomerID,

         EmployeeID,

         LineNo,

         OrderID,

        ProductID,

        ShipmentDate,

        ShipperID,

        ApplyMap('Shippers',ShipperID) as shipperkey;   

SQL SELECT *

FROM Shipments;

Regards,

prabhas.