Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
paulyeo11
Master
Master

Learn Apply Map

Hi All

I try to learn how to apply mapping .

May i know why cannot add MAPPING in below script ?

MAP:
//MAPPING
LOAD
SEG_RAW,
SEGMENT
FROM
C:\Users\pauly\Dropbox\mainqv\QV_PROJECT\MAPPING\MAPPAY.xlsx
(ooxml, embedded labels, table is ADL);

PAY:
LOAD
UserField1,
ApplyMap('Map_PAY',[UserField1],'OTHERS') as [SEGMENT_]
FROM
C:\Users\pauly\Dropbox\mainqv\QV_PROJECT\MAPPING\PAY_ADL.csv
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

Paul

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

All you have to do is add the "mapping" keyword before the load statement.

Now two things to remember about the mapping table.

1. It should have exactly 2 columns.

2. The first column should be the column for which you want to change the new value.

      and the second column should represent your new value.

 

In your case the mapping table script will be as below.

 

MAP:
MAPPING
LOAD
SEG_RAW,
SEGMENT
FROM
C:\Users\pauly\Dropbox\mainqv\QV_PROJECT\MAPPING\MAPPAY.xlsx
(ooxml, embedded labels, table is ADL);

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

22 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Paul,

You must define the table as a mapping table if you want to use the Apply map function.

If you do not define a mapping table, your Apply map function won't work.

 

 

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
paulyeo11
Master
Master
Author

Hi Kau

Thank you for your sharing. Can you share how to define the table as Mapping table ?

Paul Yeo

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

All you have to do is add the "mapping" keyword before the load statement.

Now two things to remember about the mapping table.

1. It should have exactly 2 columns.

2. The first column should be the column for which you want to change the new value.

      and the second column should represent your new value.

 

In your case the mapping table script will be as below.

 

MAP:
MAPPING
LOAD
SEG_RAW,
SEGMENT
FROM
C:\Users\pauly\Dropbox\mainqv\QV_PROJECT\MAPPING\MAPPAY.xlsx
(ooxml, embedded labels, table is ADL);

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
paulyeo11
Master
Master
Author

Hi Sir

I have define a mapping table , and also link the mapping table field i need to map UserField1 with my load script , still not working.

Map_Pay:
MAPPING
LOAD
UserField1,
SEGMENT
FROM
C:MAPPAY.xlsx
(ooxml, embedded labels, table is ADL);

PAY:
LOAD
UserField1,
ApplyMap('Map_PAY',[UserField1],'OTHERS') as [SEGMENT_]
FROM
C:PAY_ADL.csv
(txt, codepage is 1252, embedded labels, delimiter is ',', msq);

Paul

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

I don't see any error in the script.

What is the error that you get?

Can you share the data to recreate your issue on my environment?

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
paulyeo11
Master
Master
Author

Hi Sir

I don't get any error msg. just that it cannot recode .

enclosed my raw data.

Paul

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

It didnt work because the Mapping table name that you were supplying in Applymap Function was wrong.

It should have been "Map_Pay" but you have used "Map_PAY".

Thus it didnt find the Mapping table and thus it didnt work.

Try with the exact mapping table name and it should work.

 

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
paulyeo11
Master
Master
Author

Hi Sir

I hv try to make both Map_Pay the same , but it still cannot work.

Any other  suggestion ?

Paul

paulyeo11
Master
Master
Author

Hi Sir

I just test when i comment Mapping it work fine.

where go wrong ?

Paul