Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

airobles
New Contributor II

Change Format Date Text to Number / Cambio Formato Fecha Texto a Número

Hello ,


I have the following problem


How can I change the Format of a month, from Text to Number from the Load? I need it to be able to create the Weekday. Since in the loading file I have the three elements separated and the month arrives in text format.


Example:


JANUARY = 01


FEBRUARY = 02,


MARCH = 03




Thank you,

Note: Translation added by Community Moderator as a courtesy. Please use English in main forums.

- - -

Hola ,

Tengo el siguiente problema.

Como puedo cambiar el Formato de un mes, de Texto a Número desde el Load? Lo necesito para poder crear el Weekday. Ya que en el archivo de carga tengo los  tres elementos separados y el mes llega en formato texto.

Ejemplo:

JANUARY = 01

FEBRUARY = 02,

MARCH = 03

Gracias,

1 Solution

Accepted Solutions
Digvijay_Singh
Honored Contributor III

Re: Cambio Formato Fecha Texto a Número

Do you mean you are receiving Month as 'JANUARY'? from your source?

You can have mapping table like this -

Map_Table:

Mapping Load

* inline [

MonthText,MonthNo

JANUARY,01

FEBRUARY ,02

...

...

...

];


Now in your load statement you can use Apply Map as

Applymap('Map_Table',YourMonthfield,'NA') as MonthNum


4 Replies
Digvijay_Singh
Honored Contributor III

Re: Cambio Formato Fecha Texto a Número

Do you mean you are receiving Month as 'JANUARY'? from your source?

You can have mapping table like this -

Map_Table:

Mapping Load

* inline [

MonthText,MonthNo

JANUARY,01

FEBRUARY ,02

...

...

...

];


Now in your load statement you can use Apply Map as

Applymap('Map_Table',YourMonthfield,'NA') as MonthNum


airobles
New Contributor II

Re: Cambio Formato Fecha Texto a Número

Tanks Singh ! ,

It worked as wanted. now the field I can handle it

///

LOAD 

      MAKEDATE("[TIME].[TIME].[CALENDARYEAR].[MEMBER_CAPTION]",

                             Applymap('Map_Table',"[TIME].[TIME].[MONTHNUMBEROFYEAR].[MEMBER_CAPTION]",'NA'),

                               "[TIME].[TIME].[DAYNUMBEROFMONTH].[MEMBER_CAPTION]")

                             AS PERIODO,

///

Regards.

Re: Change Format Date Text to Number / Cambio Formato Fecha Texto a Número

Hi,

another solution might be;

QlikCommunity_Thread_294558_Pic1.JPG

SET LongMonthNames='January;February;March;April;May;June;July;August;September;October;November;December';

table1:

LOAD *,

    Num(Month(Date#(MonthText,'MMMM')),'00') as Month

INLINE [

    MonthText

    JANUARY

    FEBRUARY

    MARCH

];

hope this helps

regards

Marco

airobles
New Contributor II

Re: Change Format Date Text to Number / Cambio Formato Fecha  Texto a Número

Tanks Marco!