Focal Point
[SOLVED]convert month name alpha field to month integer smart date

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/7987016286

June 02, 2016, 04:55 AM
SWES
[SOLVED]convert month name alpha field to month integer smart date
Hi,

I use ROWS - OVER to always have 12 lines for each month every request.

BY MONTH AS MONTH_TXT ROWS JAN OVER FEB OVER MAR OVER APR OVER MAY OVER JUN OVER JUL OVER AUG OVER SEP OVER OCT OVER NOV OVER DEC


Now I have the months 'hardcoded', to convert back to integer for correct sorting in the end.

MONTH_DIG/A3 = DECODE MONTH_TXT (Jan '01' Feb '02' Mar '03' Apr '04' May '05' Jun '06' Jul '07' Aug '08' Sep '09' Oct '10' Nov '11' Dec '12' ELSE '');


This works fine, however there must be a way to convert using DATE functions, would anyone know how to and which function to use?

Thanks,
SWES

This message has been edited. Last edited by: <Emily McAllister>,


WebFOCUS 8105m
Windows 7, All Outputs

Member of the Benelux Usergroup
June 02, 2016, 07:37 AM
Tony A
You could use HINPUT within HPART?

-SET &MONTHNM = 'MAY';
-SET &MONTHNO = HPART(HINPUT(11, '01 &MONTHNM.EVAL 2016', 8, 'HYYMDs'), 'MONTH', 'I2');

-? &MONTH

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
June 02, 2016, 01:31 PM
SWES
Thanks for your suggestion Tony. The only thing is that here you have to hardcode '01' and '2016' in the part:
'01 &MONTHNM.EVAL 2016'



WebFOCUS 8105m
Windows 7, All Outputs

Member of the Benelux Usergroup
June 02, 2016, 01:43 PM
Tony A
Shouldn't be a problem as you're only after the month anyway. As every month will have a 1st in any year, you could just use '1' and any arbitrary year - they'll be discarded anyway!

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10