Focal Point
[CLOSED] Sorting of Month-YY

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

March 30, 2010, 12:30 PM
Ramesh Jayakumar
[CLOSED] Sorting of Month-YY
Hi,I have a column in the format of Mon-YY and i need to sort this column.I tried using
conversion of Alpha numeric to Date also with HDATe but in vain.can anyone please help me on this

And my o/p column will has always 12 months and it wil dynamicaly cahneg based on the entered Mon-YY.

Eg: Mar-09 Feb-10

This message has been edited. Last edited by: Kerry,


WebFOCUS 7.6.4
Windows
Excel, PDF, HTML
March 30, 2010, 12:40 PM
Darin Lee
Is the column a smart date format? (like MYY) That's the only way you'll get it to sort correctly. It appears that it is just and alpha representation. HDATE is used for date/time stamps. There is no existing "conversion" from the format you specify (Mar-09) to a smart date. You best best is to use the EDIT and/or DECODE functions:
MTH_TXT/A3=EDIT(MTH_YR_FIELD,'999');
MTH_NUM/A02=DECODE MTH_TXT('Jan' '01' 'Feb' '02'.... );
MTH_YR/A4MY=MTH_NUM | EDIT(MTH_YR_FIELD,'$$$$99');



Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
March 30, 2010, 05:11 PM
Waz
Perhaps Darin's field should be MTH_YR/A4MY=EDIT(MTH_YR_FIELD,'$$$$99') | MTH_NUM;
For sorting purposes


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

March 31, 2010, 11:45 AM
Darin Lee
Actually, to complete the thought, it would have to be converted from an alpha to a smart date ( format MY or YM - wouldn't matter which). As soon as it's a smart date, it will sort in the correct order. As long as it's in alpha format it will have sorting problems. Especially since you're only using a two-digit year. Year 2000 (00) would sort BEFORE year 1999 (99).


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat