How can I sort months (jan,feb,march...december). Thanks in advance
I try this. TABLE FILE SPECIAL_REPORT PRINT TOTAL_RECORDS BY EACH_MONTH
But the result is not what i inspected.
EACH_MONTH TOTAL_RECORDS APRIL 9023 AUGUST 8083 FEBRUARY 7215 JANUARY 9530 JULY 7490 JUNE 7330 MARCH 7041 MAY 8922 SEPTEMBER 8437This message has been edited. Last edited by: <Kathryn Henning>,
Webfocus 7.7.02, Win 7,Pdf, Excel, HTML
October 16, 2013, 04:16 PM
Francis Mariani
Create a DEFINE or COMPUTE column that is a date formatted column based on your alpha column, then us it as a BY NOPRINT before your alpha column.
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
October 16, 2013, 04:53 PM
Francis Mariani
Even better - read the following:
Describing Data With WebFOCUS Language > Describing an Individual Field > Converting Alphanumeric Dates to WebFOCUS Dates
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
October 16, 2013, 05:56 PM
Vivian
You would benefit from the (almost) 1001 Ways to Work with Dates available PDF from www.aviter.com.
It has TONS of info on manipulating dates.
Good luck.
Vivian
Vivian Perlmutter Aviter, Inc.
WebFOCUS Keysheet Rel. 8.0.2 (Almost) 1001 Ways to Work with Dates thru Rel. 8.0.2 Focus since 1982 WebFOCUS since the beginning Vivian@aviter.com
October 18, 2013, 06:10 AM
Hank W.
As Francis said you need to carry the month numbers as otherwise you get sorted by ABC's. Usually you have the month as a number field in the database so you carry say MONTH_NR and MONTH_NM and use the MONTH_NR as the BY NOPRINT field.
Depending on how your DB is set up usually you have a translation table for the date formats - if not that might be an idea as it saves a lot of coding. Or then you create a module you can use as INCLUDE that does the most usual and annoying format changes if the DBA's don't want to play ball.
Cheers, H. WebFOCUS 8.1.05M Oracle 11g - DB2 RedHat
TABLE FILE MONTHSALES
SUM SALES
BY MONTH
END
MONTH SALES
January 16
February 22
March 27
April 36
May 21
June 32
August 36
September 12
October 11
November 29
December 43
From:
TABLE FILE MONTHSALES
PRINT ID MONTH SALES
END
ID MONTH SALES
1 September 12
2 October 11
3 June 32
4 May 21
5 April 17
6 January 16
7 February 22
8 December 43
9 November 29
10 March 27
11 August 36
12 April 19
Alan. WF 7.705/8.007
October 21, 2013, 04:15 PM
Francis Mariani
That's a revelation - thanks Alan.
Too bad Mtr is not consistently recognized. This won't work:
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
October 22, 2013, 10:18 AM
Tewy
I tried Alan's solution on my oracle dates table but it only works if I am using PRINT.
SUM only works if I let WebFOCUS do the aggregation by issuing the ENGINE SQLORA SET OPTIMIZATION NOAGGR command.
e.g.
TABLE FILE DATES PRINT DAY BY MONTH END
will work
TABLE FILE DATES SUM CNT.DAY BY MONTH END
returns the following error:
(FOC1400) SQLCODE IS 1722 (HEX: 000006BA) : ORA-01722: invalid number (FOC1407) SQL FETCH CURSOR ERROR. : DATES
Are there some database limitations to using this?
WF 7.6.11 Output: HTML, PDF, Excel
October 22, 2013, 12:28 PM
Alan B
Interesting. I've only used this on MySQl and SQL Server with 7.703 and above. So possible, and obviously, there are limitations. Is this using DATEPATTERN?
Alan. WF 7.705/8.007
October 24, 2013, 04:09 AM
Tewy
The oracle table has a column with varchar2(3) format called CALENDARMONTHSHORTNAME, the data is like Jan, Feb etc.
I defined a column that looks like this in the master file: