Focal Point
[CLOSED]Month in alphanumeric from a date field

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

August 31, 2016, 01:33 PM
KellyT
[CLOSED]Month in alphanumeric from a date field
I have tried using the HName to pull the month from a date and have been unable to get it to work.

I am able to pull the month in Integer using DPART but they really want the Month in words rather than numbers.

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


Prod: WebFOCUS 8.2.0.4
OS: Windows
Outputs: HTML, PDF, Excel, PPT
In Focus since 2005
August 31, 2016, 02:27 PM
RSquared
please post the code that doesn't work. I have used 'HNAME' and it works.


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
August 31, 2016, 03:08 PM
KellyT
MTH/A10=HNAME(today,'MONTH','A10')


Error:
Invalid Type Of Argument #1 for user Function HName


Prod: WebFOCUS 8.2.0.4
OS: Windows
Outputs: HTML, PDF, Excel, PPT
In Focus since 2005
August 31, 2016, 03:32 PM
BabakNYC
What's the format of today field?


WebFOCUS 8206, Unix, Windows
August 31, 2016, 03:43 PM
Francis Mariani
HNAME requires the date to be date-time format.

TABLE FILE CAR
PRINT
COUNTRY NOPRINT
COMPUTE HTODAY/HYYMD = HDTTM('&YYMD', 8, 'HYYMD');
COMPUTE MTH/A10=HNAME(HTODAY,'MONTH','A10');
WHERE RECORDLIMIT EQ 1
END



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
August 31, 2016, 04:01 PM
Francis Mariani
If you're brave, you can try it in one statement:

TABLE FILE CAR
PRINT
COUNTRY NOPRINT

COMPUTE MTH/A10=HNAME( HDTTM('&YYMD', 8, 'HYYMD'), 'MONTH', 'A10');

WHERE RECORDLIMIT EQ 1
END



Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
August 31, 2016, 05:00 PM
eric.woerle
Why bother converting it at all? There is a data type for the month name. Mtr

 TABLE FILE YOUR_TABE
SUM YOUR_DATE/Mtr
BY YOUR_DATE
END
  


You can also use the FPRINT function to convert it to alpha if needed, but if you just want to display it, I wouldn't bother converting it from a smart date.


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2