Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
arulsettu
Master III
Master III

apply map

hi

i want to add  this InvoiceQty and QtyOrdered by using apply map function

so i tried here

InvoiceQty:

Mapping LOAD ItemNumber,

                          InvoiceQty

Resident Invoice;

test1:

LOAD ItemNumber,

          ApplyMap('InvoiceQty',QtyOrdered) as newqty

Resident Orders;    

but the result is it only showing QtyOrdered data.

what am i doing wrong any suggestions?

1 Solution

Accepted Solutions
ashfaq_haseeb
Champion III
Champion III

Hi

What I see is you have multiple quantities for one ItemID.

By default applymap will take first value.

Have a look at below post for further clarification

http://community.qlik.com/message/534391#534391

Regards

ASHFAQ

View solution in original post

14 Replies
amit_saini
Master III
Master III

Hope this will  help you:

Thanks,
AS

tresesco
MVP
MVP

Perhaps, like this:

LOAD ItemNumber,

          ApplyMap('InvoiceQty', ItemNumber) as newqty

Resident Orders;    

arulsettu
Master III
Master III
Author

sorry amit using personal edition can tell whats wrong with the above code

thanks

Not applicable

Use ItemNumber instead of QtyOrdered in ApplyMap function..

amit_saini
Master III
Master III

Arul,

'ItemNumber' should be here instead of 'QtyOrdered' here in below script:

ApplyMap('InvoiceQty',QtyOrdered) as newqty


Thanks,

AS

amit_saini
Master III
Master III

To understand the concept please see below:

Script:

Purchase:

LOAD * Inline [

PurchaseID,Product,PurchasePrice,Quantity,PurchaseDate

P9, Product1, 8,  20, 15/10/2010

P11, Product1, 7,  10, 09/10/2010

P12, Product1, 9,  20, 01/10/2010

];

Temp:

Mapping LOAD

Product,PurchasePrice

Resident Purchase;

DROP Table Purchase;

Sales:

LOAD ApplyMap('Temp', Product ) as PurchasePrice,* Inline [

SalesID,Product,SalesPrice,Quantity,SalesDate

S1, Product1, 10,  10, 10/10/2010

];

Output:

Thanks,
AS

aveeeeeee7en
Specialist III
Specialist III

Use ItemNumber which is the Primary Key between 2 Tables:

Change your Code. See below:

InvoiceQty:

Mapping LOAD ItemNumber,

                          InvoiceQty

Resident Invoice;

test1:

LOAD ItemNumber,

          ApplyMap('InvoiceQty',ItemNumber) as newqty

Resident Orders; 

Regards

Av7eN

arulsettu
Master III
Master III
Author

like this

ApplyMap('InvoiceQty',ItemNumber) as newqty

but it giving same result

ashfaq_haseeb
Champion III
Champion III

Post your sample application to have a look.

Or try by changing your code like this

InvoiceMAP:

Mapping LOAD ItemNumber,

                          InvoiceQty

Resident Invoice;

test1:

LOAD ItemNumber,

          ApplyMap('InvoiceMAP',ItemNumber) as newqty

Resident Orders;   

Regards

ASHFAQ