Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Format Date When Loading

Hello,

How do I get the month function to accept only the month number when loading in data?

Here is part of my script:

Map_Months:

MAPPING LOAD * INLINE [

In,Out

Jan,01

Feb,02

Mar,03

Apr,04

May,05

Jun,06

Jul,07

Aug,08

Sep,09

Oct,10

Nov,11

Dec,12

];

Table1:

LOAD Month(ApplyMap('Map_Months',Month)) AS Month

1 Solution

Accepted Solutions
sunny_talwar

Try without the Month() function

Table1:

LOAD ApplyMap('Map_Months', Month) as Month

or this

Table1:

LOAD ApplyMap('Map_Months', Month(Date#(Month, 'MMM'))) as Month

View solution in original post

2 Replies
sunny_talwar

Try without the Month() function

Table1:

LOAD ApplyMap('Map_Months', Month) as Month

or this

Table1:

LOAD ApplyMap('Map_Months', Month(Date#(Month, 'MMM'))) as Month

Anonymous
Not applicable
Author

It looks like you are specifying two columns. One with an abbreviation of the month name "In" and one with a number called "Out".

I don't think you need the mapping load, unless there is another reason for it.

I removed the mapping load and ApplyMap function and it loaded fine based on the inline data.

Map_Months:

LOAD * INLINE [

In,Out

Jan,01

Feb,02

Mar,03

Apr,04

May,05

Jun,06

Jul,07

Aug,08

Sep,09

Oct,10

Nov,11

Dec,12

];

Table1:

LOAD dual(Month('Map_Months')) AS Month