Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Mapping function


Hi All,

I am a bit confused in maping function. So can any one give me a example of mapping functions?

Thanks,

D J

5 Replies
Not applicable
Author

This is from Qlikview help & reference manual :

Mapping:

1. Mapping prefix is used before a select or load statement for mapping certain field value/expression to the values in the first column of mapping table.

2. Mapping table consists of 2 columns, first containing teh comparison values and second containing the desired mapping values.

Eg.

Map1:

Mapping load * Inline [

x,y

US,United States

U.S, USA

America, United States Of America

];

Now, you can use 'Applymap' function to retrieve the values
Applymap ('map1', US) returns United States

Applymap('map1', U.S.) returns USA.

Hope this helps!

EDIT: One more point about mapping tables is they will be stored temporarily in the memory and will be dropped automatically after script execution.

Not applicable
Author

Hi Dhiraj,

Basically Mapping Function, consists of 2 things.

1. Mapping Load

2. ApplyMap()

* Mapping Load, is nothing but a table (to map another Table(Inline Table) )

      Condition:-  * Mapping load table should contain only 2 fields, 1)MapID   2)MapValue.

                       * Mapping load table should load before than Applymap() function.                

* Apply Map() is a function (where applying mapping function on table(Database Table)).

Example:--

I have table name "Emp", it has a field name "Gender", values on the field are M & F

where M = Male, F = Female.

Syntax:--

GenderTable:

Mapping Load * inline [     // this is an inline table, need to add Mapping before Load statement

MapID, MapValue

M, Male

F, Female

];

Emp:

load EmpName,

Salary,

Gender

ApplyMap('GenderTable', Gender) as Gender_Desc  //applying the mapping values to this table using Applymap()

From********;

Hope this helps you.

Mark as correct answer and let others know about this.

Regards,

Pavan.

ngulliver
Partner - Specialist III
Partner - Specialist III

Hi, Dhiraj.

Have a look at this blog:

http://www.quickintelligence.co.uk/applymap-is-it-so-wrong/

It may be able to clarify a few things for you.

Regards,

Neil

Anonymous
Not applicable
Author

Hi,

I think it's about the use and not the syntax, so my best example is a customername.

In our orders and deliverynotes and invoices and pricelist and .. and ... we only have a key to the right customer but not its name.

So when I work with those tables I firstly load the mapping-table with the customer code and name (starting from the table customers)

After that I load the other tables with somthing like

Applymap ('MapCustomerName', customer_code) AS  customer_name

this way your database does not have to have the customername in every 200 orders,invoices,..... this client has.

Same logic goes for names, addresses, phonenrs. ...... of articles, suppliers, ... and I was told it's better than joining tables if you only need 1 or 2 fields.

Paul

vikasmahajan

PFA

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.