Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Apply Map Usage

Hi,

I am not clear on usage of Applymap()

In below scenario  "Order_Id" is common column between "Customers" and "Orders" tables

ApplyMap() is used to fetch "Item" column from "Orders" table and add to "Customers" table, below mentioned also the script and table viewer screenshot

If I do not use ApplyMap() , simply load both tables (Customers and Orders) and create two Listboxes one for "Customer_Name"  and another for "Item" then I can directly show "Item" associated with "Customer_Name"  by selecting any value from "Customer_Name" listbox

Customers:

Customer_IdCustomer_NameOrder_Id
CUS001DennisORCUS00101
CUS001DennisORCUS00102
CUS002MariyaORCUS00201
CUS002MariyaORCUS00202
CUS003BobORCUS00301
CUS003BobORCUS00302
CUS003BobORCUS00303

Orders:

Order_IdItemQuantity
ORCUS00101Toothpaste2
ORCUS00102Grocery1
ORCUS00201Bread1
ORCUS00202Chocolate5
ORCUS00301Vegetable oil1
ORCUS00302Ginger8
ORCUS00303Ketchup2

Script:

Orders:
LOAD Order_Id,
Item,
Quantity
FROM

(
ooxml, embedded labels, table is Orders);



Map:
Mapping LOAD
Order_Id,
Item
Resident Orders;

Customers:
LOAD Customer_Id,
Customer_Name,
Order_Id,
ApplyMap('Map',Order_Id,'NA') As Itemname
FROM

(
ooxml, embedded labels, table is Customers);

Table Viewer:

3 Replies
arasantorule
Creator III
Creator III

Hi,

Apply map is used to map a pair of unique values related to each other.

Applymap() in above example is applicable only if each order_id will always have only one Item.

Please refer the below for more details.

Don't join - use Applymap instead

Thanks.

muthukumar77
Partner - Creator III
Partner - Creator III

Hi,

ApplyMap Function in Qlikview

Muthukumar Pandiyan
qlikview979
Specialist
Specialist

Hi,

You Have One common field(Order_Id ) between two table that's why you are getting Association between

"Customer_Name" and "Item". if you drop the common field in any one table  your not able to get the association.

Please check my attached file for Applaymap

T1:

load * Inline [

Order_Id, Item, Quantity

ORCUS00101, Toothpaste, 2

ORCUS00102, Grocery ,1

ORCUS00201, Bread ,1

ORCUS00202, Chocolate, 5

ORCUS00301, Vegetable oil, 1

ORCUS00302, Ginger, 8

ORCUS00303, Ketchup, 2

];

T2:

mapping load

Order_Id ,

Item

Resident T1;

T3:

mapping load

Order_Id ,

Quantity

Resident T1;

DROP Table T1;

T4:

load * Inline [

Customer_Id, Customer_Name, Order_Id

CUS001, Dennis ,ORCUS00101

CUS001, Dennis ,ORCUS00102

CUS002, Mariya ,ORCUS00201

CUS002, Mariya ,ORCUS00202

CUS003, Bob ,ORCUS00301

CUS003, Bob ,ORCUS00302

CUS003, Bob ,ORCUS00303

];

NoConcatenate

T5:

load

Customer_Id,

Customer_Name,

Order_Id,

ApplyMap('T2',Order_Id,'') as Applymap1,

ApplyMap('T3',Order_Id,'') as Applymap2

Resident T4;

DROP table T4;