Focal Point
[SOLVED] Minimum date in subtotal

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

February 05, 2015, 09:40 AM
Wep5622
[SOLVED] Minimum date in subtotal
I'm trying to get the minimum date in the subtotals per region here, but they remain blank. What's the trick?

DEFINE FILE GGSALES
	DATE1/YYMD	= DATECVT(DATE, 'I8YYMD', 'YYMD');
	DATE2/HYYMD	= HDTTM(DATE1, 8, 'HYYMD');
END
TABLE FILE GGSALES
SUM
	MIN.DATE
	MIN.DATE1
	MIN.DATE2

BY REGION
BY CITY
ON REGION RECOMPUTE MIN. DATE MIN. DATE1 MIN. DATE2
ON TABLE PCHOLD FORMAT WP
END


Output:
                                           MIN   MIN         MIN                                                                  
  Region       City                        Date  DATE1       DATE2                                                                
  ------       ----                        ----  -----       -----                                                                
  Midwest      Chicago               1996/01/01  1996/01/01  1996/01/01
               Houston               1996/01/01  1996/01/01  1996/01/01
               St. Louis             1996/01/01  1996/01/01  1996/01/01
  
  *TOTAL Midwest                                                                  
  
  Northeast    Boston                1996/01/01  1996/01/01  1996/01/01
               New Haven             1996/01/01  1996/01/01  1996/01/01
               New York              1996/01/01  1996/01/01  1996/01/01
  
  *TOTAL Northeast                                                                
  
  Southeast    Atlanta               1996/01/01  1996/01/01  1996/01/01
               Memphis               1996/01/01  1996/01/01  1996/01/01
               Orlando               1996/01/01  1996/01/01  1996/01/01
  
  *TOTAL Southeast                                                                
  
  West         Los Angeles           1996/01/01  1996/01/01  1996/01/01
               San Francisco         1996/01/01  1996/01/01  1996/01/01
               Seattle               1996/01/01  1996/01/01  1996/01/01
  
  *TOTAL West                                                                     
  
  
  TOTAL


BTW, format WP was purely used to get the output in a readable format for this forum. In reality we use format HTML.

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


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
February 05, 2015, 10:24 AM
Alan B
DATE fields, of whichever persuasion, do not SUBTOTAL, RECOMPUTE etc.

Change to an alpha format:
DEFINE FILE GGSALES
	DATE1/YYMD	= DATECVT(DATE, 'I8YYMD', 'YYMD');
	DATE2/HYYMD	= HDTTM(DATE1, 8, 'HYYMD');
	DATE3/A10       = EDIT(EDIT(DATE),'9999/99/99');
END
TABLE FILE GGSALES
SUM
	MIN.DATE
	MIN.DATE1
	MIN.DATE2
        MIN.DATE3
BY REGION 
BY CITY
ON REGION SUBTOTAL MIN. DATE DATE1 DATE2 DATE3
ON TABLE PCHOLD FORMAT HTML
END



Alan.
WF 7.705/8.007
February 05, 2015, 10:30 AM
eric.woerle
My first instinct was to use the subtotal command. But that didn't seem to work either. I'm thinking the reason is that a subtotal/recompute most likely only works on numeric values which a date is not. To get around it, I would use a subfoot

  DEFINE FILE GGSALES
	DATE1/YYMD	= DATECVT(DATE, 'I8YYMD', 'YYMD');
	DATE2/HYYMD	= HDTTM(DATE1, 8, 'HYYMD');
END
TABLE FILE GGSALES
SUM
	MIN.DATE
	MIN.DATE1
	MIN.DATE2

BY REGION
BY CITY
ON REGION SUBFOOT 
"<REGION <MIN.DATE<MIN.DATE1<MIN.DATE2"
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLENCODE ON 
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
	HEADALIGN=BODY,
$
END


Try this.


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
February 05, 2015, 03:52 PM
Nick Hilt
That GGSALES example is rather misleading since the MIN.DATE value is the same for every grouping. Just SUBFOOT'ing MIN.DATE is likely giving the last value of that field, not the overall minimum. You'd have to explicitly COMPUTE the correct minimums that you want to display. Note the difference in the summary values between
TABLE FILE EMPLOYEE
SUM MIN.HIRE_DATE
BY DEPARTMENT
BY CURR_JOBCODE
ON DEPARTMENT SUBFOOT
"<DEPARTMENT <MIN.HIRE_DATE"
ON TABLE SET STYLE *
 TYPE=SUBFOOT, HEADALIGN=BODY,$
ENDSTYLE
END

and
TABLE FILE EMPLOYEE
SUM COMPUTE SUBFOOT_DATE/YMD=MIN.HIRE_DATE; NOPRINT
BY DEPARTMENT
SUM MIN.HIRE_DATE
BY DEPARTMENT
BY CURR_JOBCODE
ON DEPARTMENT SUBFOOT
"<DEPARTMENT <SUBFOOT_DATE"
ON TABLE SET STYLE *
 TYPE=SUBFOOT, HEADALIGN=BODY,$
ENDSTYLE
END



WebFOCUS 7.6.7
Linux
HTML, Excel, PDF
February 06, 2015, 05:52 AM
Wep5622
Quite so indeed.

I'll just need to change the TALBE request into a triple-verb; one for the grand-total, one for the grouped subtotals and one for the detail data.

Not exactly convenient, but quite doable. Thanks for the help, folks!

Is it worth opening an NFR for summaries on date(-time) values? It's not that common, but I doubt I'm the first person in the history of WF with the requirement.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :