Focal Point
[CLOSED] Subtotal on Top

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

April 25, 2008, 12:50 PM
Joel
[CLOSED] Subtotal on Top
I tried to use the st. on the subhead to get the subtotals before the details. I did not have luck since it's just printing the first record instead of the subtotal. Has anyone had luck in putting subtotals on the top instead of the bottom?

TABLE FILE CAR
SUM
DEALER_COST
RETAIL_COST
BY COUNTRY
BY CAR

ON COUNTRY SUBHEAD
"HEADING
""
FOOTING
""
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
UNITS=IN,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
GRID=OFF,
FONT='ARIAL',
SIZE=9,
$
TYPE=TITLE,
STYLE=BOLD,
$
TYPE=TABHEADING,
SIZE=12,
STYLE=BOLD,
$
TYPE=TABFOOTING,
SIZE=12,
STYLE=BOLD,
$
TYPE=HEADING,
SIZE=12,
STYLE=BOLD,
$
TYPE=FOOTING,
SIZE=12,
STYLE=BOLD,
$
TYPE=SUBHEAD,
SIZE=10,
STYLE=BOLD,
$
TYPE=SUBFOOT,
SIZE=10,
STYLE=BOLD,
$
TYPE=SUBTOTAL,
BACKCOLOR=RGB(210 210 210),
$
TYPE=ACROSSVALUE,
SIZE=9,
$
TYPE=ACROSSTITLE,
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
BACKCOLOR=RGB(210 210 210),
STYLE=BOLD,
$
ENDSTYLE
END

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


7.6.6
Windows 2003 Server, Sybase IQ, DB2, SQL Server and Oracle Databases
Excel, HTML and PDF
April 25, 2008, 01:05 PM
Tom Flynn
Joel,

This works:

  
DEFINE FILE CAR
  X_COST/P13.2M = DEALER_COST;
  Y_COST/P13.2M = RETAIL_COST;
END
TABLE FILE CAR
SUM
	X_COST NOPRINT
	Y_COST NOPRINT
BY COUNTRY AS ''
SUM 
DEALER_COST/P13.2M AS ''
RETAIL_COST/P13.2M AS ''
BY COUNTRY AS '' PAGE-BREAK
BY CAR AS ''

ON COUNTRY SUBHEAD
"Country <+0> Car <+0> Dealer Cost <+0> Retail Cost"
" "
"<+0> <+0> <X_COST<Y_COST"
FOOTING
""
ON TABLE SET PAGE-NUM OFF 
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
UNITS=IN,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
GRID=OFF,
FONT='ARIAL',
SIZE=9,
$
TYPE=TITLE,
STYLE=BOLD,
$
TYPE=SUBHEAD,
STYLE=BOLD,
HEADALIGN=BODY,
JUSTIFY=LEFT,
$
TYPE=SUBHEAD,
BY=1,
LINE=3,
SIZE=10,
STYLE=BOLD,
JUSTIFY=RIGHT,
$

ENDSTYLE
END
-EXIT


Have Fun!

Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
April 25, 2008, 02:00 PM
Joel
Thanks Tom! Is there a way to align the totals with the corresponding columns?


7.6.6
Windows 2003 Server, Sybase IQ, DB2, SQL Server and Oracle Databases
Excel, HTML and PDF
April 25, 2008, 02:05 PM
Tom Flynn
Joel,

Run the code, that's what HEADLIGN=BODY does.

I put in a BY=, an easy DEFINE, 2 VERBS within 1 process, etc. to give you a feel for what WebFOCUS can do.

Now, it's your turn...

Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
April 25, 2008, 02:55 PM
Joel
Thanks Tom!


7.6.6
Windows 2003 Server, Sybase IQ, DB2, SQL Server and Oracle Databases
Excel, HTML and PDF
June 22, 2010, 03:50 PM
Joel
I have an add-on question for the Subtotal on Top. I'd like to have an across value and put the subtotal and grand totals at the top. How do I do this?

TABLE FILE CAR
SUM
     DEALER_COST
BY COUNTRY
BY CAR
ACROSS BODYTYPE

ON COUNTRY SUBTOTAL AS '*TOTAL'
ON TABLE SUMMARIZE CAR.BODY.DEALER_COST AS 'TOTAL'
END


This code shows the totals at the bottom and I'd like the totals to be on top.

Thanks for your help!


7.6.6
Windows 2003 Server, Sybase IQ, DB2, SQL Server and Oracle Databases
Excel, HTML and PDF
June 23, 2010, 04:29 AM
Twanette
I wonder if in future the new WebFOCUS 7.7 feature will in fact do what you want:
Displaying Summary Lines Above the Data

The SET SUBTOTALS command controls whether summary lines are displayed above or below the detail lines in a report. The summary commands affected include SUBTOTAL, SUBTOTAL,
RECOMPUTE, SUMMARIZE, COMPUTE, RECAP, and COLUMN-TOTAL.

SET SUBTOTALS {ABOVE|BELOW}
June 23, 2010, 09:17 AM
Tom Flynn
Long version:
  
APP PREPENDPATH IBISAMP
-RUN
SET ASNAMES = ON
DEFINE FILE CAR 
 COUNTRY/A30 = 'SUMMARY';
 CAR/A16     = ' ';
 CNTR/I2     = 0;
END
TABLE FILE CAR
SUM
     DEALER_COST
     FST.CNTR
BY COUNTRY
BY CAR
BY BODYTYPE
 ON TABLE HOLD AS HOLD1
END
-RUN
DEFINE FILE CAR 
 XCOUNTRY/A30 = 'Total ' | COUNTRY;
 CAR/A16     = ' ';
 CNTR/I2     = IF COUNTRY EQ LAST COUNTRY THEN CNTR ELSE CNTR + 1;
END
TABLE FILE CAR
SUM
     DEALER_COST
     FST.CNTR
BY XCOUNTRY AS 'COUNTRY'
BY CAR
BY BODYTYPE
 ON TABLE HOLD AS HOLD2
END
-RUN

DEFINE FILE CAR CLEAR
END
-RUN
DEFINE FILE CAR
 COUNTRY/A30 = COUNTRY;
 CNTR/I2     = IF COUNTRY EQ LAST COUNTRY THEN CNTR ELSE CNTR + 1;
END
TABLE FILE CAR
SUM
     DEALER_COST
     FST.CNTR
BY COUNTRY
BY CAR
BY BODYTYPE
 ON TABLE HOLD AS HOLD3
END
-RUN
TABLE FILE HOLD1
PRINT 
     DEALER_COST
     CNTR
BY COUNTRY
BY CAR
BY BODYTYPE
 ON TABLE HOLD AS HOLD4 
MORE
FILE HOLD2
MORE
FILE HOLD3
END
-RUN
DEFINE FILE HOLD4
  KEY_SORT/I2 = IF COUNTRY EQ 'SUMMARY'     THEN 1 ELSE
                IF COUNTRY CONTAINS 'Total' THEN 2 ELSE 3;
END
TABLE FILE HOLD4
SUM
     DEALER_COST
BY CNTR NOPRINT
BY KEY_SORT NOPRINT
BY COUNTRY
BY CAR
ACROSS BODYTYPE

ON TABLE NOTOTAL
END
-EXIT


Short Version:
quote:

SET SUBTOTALS {ABOVE|BELOW}


This is a GREAT enhancement in 7.7 - There are many, many others...

hth

EDIT: 7.7 New Features

Need to login to get to the PDF...

This message has been edited. Last edited by: Tom Flynn,


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
June 23, 2010, 01:03 PM
Joel
Thanks Twanette and Tom. I guess I have to upgrade to 7.7 then to make it easier.


7.6.6
Windows 2003 Server, Sybase IQ, DB2, SQL Server and Oracle Databases
Excel, HTML and PDF