Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi experts,
what is the mapping load syntax?
Hi prabhas,
Copied from another post.
he MAPPING statement provides an alternative to the JOIN statement in a very specific scenario: when you want to replace a single key value with a value from a lookup (mapping) table.
We prefix ' Mapping' to the load statement to tell Qlikview that a table is a mapping table.
• It can only have two columns, the first being the lookup value and the second being the mapping value to return.
• It is a temporary table. At the end of the script, QlikView automatically removes the table from the data model.
The mapping table is called with the 'Applymap()' function
Sample Code:
#####################################
Map_Price: //Mapping Table
Mapping LOAD * INLINE [
Category, Price
Adult, 10
Child, 5
Student, 6
Senior, 6
LoyalMember, 5
];
Tickets:
LOAD * INLINE [
Name, Class
Ann, Student
David, Adult
Sara, Senior
Keith, Child
Tom, Adult
Dave, Student
Sam, Adult
Monica, LoyalMember
Ethan, Student
Rose, Child
];
Price:
Load
Name,
Class,
ApplyMap('Map_Price',Class) as TicketPrice //Here we use applymap to look up for the ticket prices
Resident
Tickets;
Drop Table Tickets
Hi
Mapping load has always only two fields - one is mapping field & another is its value.
So you can create Mapping table as -
MapTable:
Mapping Load mappingfieldname,
value
FROM maptable;
This mapping table can be used in your main data as -
ActualTable:
Load Field1, ..., Fieldn,
mappingfieldname,
Applymap('MapTable', mappingfieldname) as MappedValueField
FROM DATA.qvd (qvd);
This will map value of MapTable into ActualTable.
Hope this will help you to understand the concept.
--
Regards,
Prashant P Baste