Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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.
Use
Date(TempDate,'MMMM') as [Date of Entry Month long],
month(TempDate) as [Date of Entry Month],
You don't need Mapping Load here.
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.
Thank you both, both true :-).