Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi
i have a month name and i want to convert it into month_number.
i am getting only month_name form the datasource,
ex: if it is june , i want to convert to 06
Use a mapping and applymap to add the month number
MonthMap:
Mapping LOAD * INLINE
[ month_str, month_num
Januari, 01
Februari, 02
March, 03
April, 04
May, 05
June, 06
July, 07
August, 08
September, 09
October, 10
November, 11
December, 12
];
SomeTable:
load
a,
b,
c,
MyMonth,
ApplyMap('MonthMap',MyMonth)
from ...etc
other than apply map is there any solution like writing functions to convert ...
Hi
Try like this
Num(Month(DateField)) as Month for 6
Hope it helps
thanks for the reply but i have only month_name but not datefeild ..then how?
Hi
Then you can try gwassenaar method or just inline table
LOAD * INLINE
[ Month, MonthNum
January, 01
February, 02
March, 03
April, 04
May, 05
June, 06
July, 07
August, 08
September, 09
October, 10
November, 11
December, 12
];
Load MonthField as Month, * from tableName;
And use 'MonthNum' whenever you need..
Hope that helps