Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

applymap

Hi ,

I am getting error like "MAPPING requires 2-column input" when i use the below script.

Product:
MAPPING LOAD
SellStartDate,
StandardCost

resident Product;

Load
OrderQty,
OrderQty * ApplyMap('Product',StandardCost,0) as SalesAmount
Resident SalesOrderHeader;

Can anybody look into this .Any help will be highly appreciated.

Regards,

Phani

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

try it like this:

Product:
MAPPING LOAD
SellStartDate AS X,
StandardCost AS Y

resident Product;

Load
OrderQty,
OrderQty * ApplyMap('Product',<field name that you want to change from current table>) as SalesAmount
Resident SalesOrderHeader;

<field name that you want to change from current table> this is the current field from current table you wish to transform not the field from MAPPING TABLE.

Regards, Miha

View solution in original post

4 Replies
Not applicable
Author

Hi,

try it like this:

Product:
MAPPING LOAD
SellStartDate AS X,
StandardCost AS Y

resident Product;

Load
OrderQty,
OrderQty * ApplyMap('Product',<field name that you want to change from current table>) as SalesAmount
Resident SalesOrderHeader;

<field name that you want to change from current table> this is the current field from current table you wish to transform not the field from MAPPING TABLE.

Regards, Miha

Not applicable
Author

Hi,

Thanks for your Message. Actually i want to calculate Sales amount by using Orderqty*standardCost but both fields are in different tables , and i don't want to join that two tables.I tried your code but getting the same error.

Thanks in Advance,

Regards,

Phani

johnw
Champion III
Champion III

You'll probably also need to name your mapping table something different than the resident table you're loading it from. Call it ProductMap, for instance.

Anonymous
Not applicable
Author

I always, except "load inline", use distinct in mapping load. It would be:
ProductMap:
MAPPING LOAD DISTINCT
SellStartDate AS X,
StandardCost AS Y
RESIDENT Product;