Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Friends,
i'm having the Month_FullName as a field. How can i get short names from this filed.
for e.g; January, February, March........... to Jan , Feb, Mar, Apr.......
Please suggest how to do it.
Regards
Krishna
Hi,
the reason for the behaviour you experienced is that you already loaded your month_fullnames as a date field formatted as month fullnames. So the proposed solutions using the Date# function didn't find a string to interpret as a date (that's what the #-functions do).
On the other hand this means, that your front end expression
=Month(Date(Month_FullNames,'MMM'))
can be abbreviated to
=Month(Month_FullNames)
as the formatting date() function is useless in this case, it does not change the underlying numerical value of your Month_FullNames field (Ret_Month).
Using this expression
Date(Date#(SubField('$(MonthNames)',';',MONTH),'MMM'),'MMMM') as Ret_Month
to create your Ret_Month field in the script leads to somewhat weird underlying numerical values:
because you are trying to create a complete date value from only a month field (the year information is missing) and then just formatting it to show month fullnames.
I therefore stick to my proposed solution
Dual(Date(Date#(MONTH,'MM'),'MMMM'), MONTH) as Ret_Month
which creates these underlying values:
like one would expect from a real month field.
If you wanted to create the month shortname field in the script, then one solution could be:
Month(Date#(MONTH,'MM')) as Ret_Month_short
hope this helps
regards
Marco
Hi Krishna20,
Would this work in all months :
left('January',3)
Mark
www.techstuffy.com
Hi Mark ,
Thank you for your immediate reply. I want to show all field names in list box.
Regards
Krishna
Use mapping table or otherwise load another table like
Fact:
load * inline
[
FullNameMonths
January
February
March
April
May
June
July
August
September
October
November
December
];
MonthTable:
Load * inline[
FullNameMonths, SortMOnthName
January, Jan
February, Feb
March, Mar
April, Apr
May, May
June, Jun
July, Jul
August, Aug
September, Sep
October, Oct
November, Nov
December, Dec
];
And in place of the FullNameMonths use SortMOnthName
Regards,
Anand
Hi,
Left(Month,3)
or else
Month(Month_fullname,'MMM')
Or else create a inline table with month field
Load * inline[
Month_fullName, Monthname
January, jan
];
e.g.
Month(Date#('September','MMMM'))
returns 'Sep' with an underlying numerical value of 9
hope this helps
regards
Marco
Even you can map another table like
MapTab:
Mapping LOAD * INLINE [
FullNameMonths, SortMonthName
January, Jan
February, Feb
March, Mar
April, Apr
May, May
June, Jun
July, Jul
August, Aug
September, Sep
October, Oct
November, Nov
December, Dec ];
LOAD ApplyMap('MapTab',FullNameMonths) as SortMonName,FullNameMonths;
LOAD * INLINE [
FullNameMonths
January
February
March
April
May
June
July
August
September
October
November
December ];
And in list bx use only SortMonName field
Regards,
Anand
For localization issues you can adjust the long month names with this variable:
SET LongMonthNames='January;February;March;April;May;June;July;August;September;October;November;December';
hope this helps also
regards
Marco
Krishna,
Like this , see the attachment.
Thanks,
AS