Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

chriys1337
Not applicable

applymap does not work?

Hi all,

I want to replace the short month names, e.g. Jan with the full version, e.g January.

For this purpose I tried to use applymap, but it does not work - why? Could you help me?

MonthMapping:
Mapping LOAD * INLINE [

Date of Entry Month, Date of Entry Month long

Jan, January

Feb, February

Mar, March

Apr, April

May, May

Jun, June

Jul, July

Aug, August

Sep, September

Oct, October

Nov, November

Dec, December]
;

LOAD *, applyMap('MonthMapping',[Date of Entry Month], 'N/A') as [Date of Entry Month long]; // preceding load
[$(vL.TableName)]:
LOAD  
left(num(TempDate),5) as [Date of entry], // just Day, Month and Year indication
  date#(TempDate,'MM/DD/YYYY') as [Date of entry Date],
year(TempDate) as [Date of Entry Year],
month(TempDate) as [Date of Entry Month],
num(month(TempDate)) as [Date of Entry Month num],
weekyear(TempDate) as [Date of Entry CW],
day(TempDate) as [Date of Entry Day]
RESIDENT TempCal;

Just N/A comes out, which shows me that there is no match. If I don't fill out the third parameter at my applymap, the original text remains, e.g. Jan, Feb... and not the long version as I wish.

1 Solution

Accepted Solutions
Peter_Cammaert
Not applicable

Re: applymap does not work?

And the reason why the applymap() call doesn't seem to work is probably because you are passing a dual value but the mapping table only contains text values. Try again by modifying the first INLINE LOAD column from Jan to 1, Feb to 2 and so on. That is, if you didn't already decide to use Manish's more efficient solution.

3 Replies
MK_QSL
Not applicable

Re: applymap does not work?

Use

Date(TempDate,'MMMM') as [Date of Entry Month long],

month(TempDate) as [Date of Entry Month],

You don't need Mapping Load here.

Peter_Cammaert
Not applicable

Re: applymap does not work?

And the reason why the applymap() call doesn't seem to work is probably because you are passing a dual value but the mapping table only contains text values. Try again by modifying the first INLINE LOAD column from Jan to 1, Feb to 2 and so on. That is, if you didn't already decide to use Manish's more efficient solution.

chriys1337
Not applicable

Re: applymap does not work?

Thank you both, both true :-).