Focal Point
[CLOSED] Report total on sort level

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

October 24, 2014, 05:16 AM
ruhan
[CLOSED] Report total on sort level
Hi

I would like to achieve the following report where the grand total is not just a one-liner but give totals per SEATS. Is this possible with a setting which I've missed? I know you can do it in a two step process where the totals are concatenated (read MORE) with the detail.

TABLE FILE CAR
SUM DEALER RETAIL
BY COUNTRY SKIP-LINE
BY SEATS AS SEATS
ROWS 2 OVER 4 OVER 5
ON TABLE COLUMN-TOTAL AS WORLD [OPTION...]
END
  COUNTRY     SEATS  DEALER_COST  RETAIL_COST
  -------     -----  -----------  -----------

  ENGLAND     2           11,719       13,978
              4           14,940       17,850
              5           11,194       13,491

  FRANCE      2                .            .
              4                .            .
              5            4,631        5,610

  ITALY       2           36,320       45,140
              4            4,915        5,925
              5                .            .

  JAPAN       2                .            .
              4            5,512        6,478
              5                .            .

  W GERMANY   2                .            .
              4            6,000        6,355
              5           48,563       58,377

  WORLD       2           48,039       59,118
              4           31,367       36,608
              5           64,388       77,478

Thanks
Ruhan

This message has been edited. Last edited by: ruhan,
October 24, 2014, 06:35 AM
Alan B
Not a setting as far as I know. But also you can do it one step. This is not the neatest I've ever done, but you should get my drift:
DEFINE FILE CAR
N_COUNTRY/A10 = 'WORLD';
2SEATS/I4 = 2;
4SEATS/I4 = 4;
5SEATS/I4 = 5;
RETAIL2 = IF SEATS EQ 2 THEN RETAIL_COST ELSE 0; 
RETAIL4 = IF SEATS EQ 4 THEN RETAIL_COST ELSE 0; 
RETAIL5 = IF SEATS EQ 5 THEN RETAIL_COST ELSE 0; 

DEALER2 = IF SEATS EQ 2 THEN DEALER_COST ELSE 0; 
DEALER4 = IF SEATS EQ 4 THEN DEALER_COST ELSE 0; 
DEALER5 = IF SEATS EQ 5 THEN DEALER_COST ELSE 0; 


END
TABLE FILE CAR
SUM DEALER_COST RETAIL_COST 

DEALER2 NOPRINT DEALER4 NOPRINT DEALER5 NOPRINT 
RETAIL2 NOPRINT RETAIL4 NOPRINT RETAIL5 NOPRINT 
MAX.2SEAT NOPRINT MAX.4SEATS NOPRINT MAX.5SEATS NOPRINT

BY COUNTRY SKIP-LINE
BY SEATS
ON TABLE SUBFOOT
" "
"<N_COUNTRY<MAX.2SEATS<TOT.DEALER2<TOT.RETAIL2" 
"<+0> <MAX.4SEATS<TOT.DEALER4<TOT.RETAIL4" 
"<+0> <MAX.5SEATS<TOT.DEALER5<TOT.RETAIL5" 
ON TABLE SET STYLE *
HEADALIGN=BODY,GRID=OFF,$
TYPE=TABFOOTING, COLSPAN=4,$
TYPE=TABFOOTING, ITEM=1, POSITION=N1,$
TYPE=TABFOOTING, ITEM=2, POSITION=N2,$
TYPE=TABFOOTING, ITEM=3, POSITION=N3,$
TYPE=TABFOOTING, ITEM=4, POSITION=N4,$
ENDSTYLE
END



Alan.
WF 7.705/8.007
October 24, 2014, 04:14 PM
j.gross
Or:
SET ASNAMES=ON
DEFINE FILE CAR
WORLD/A10 WITH COUNTRY = '*WORLD';
ONE/I1=1;
TWO/I1=2;
END

TABLE FILE CAR
SUM DEALER RETAIL
BY ONE AS ORDER
BY COUNTRY 
BY SEATS 
WHERE SEATS IN (2,4,5);
ON TABLE HOLD AS HOLD1 
END

TABLE FILE CAR
SUM DEALER RETAIL
BY TWO AS ORDER
BY WORLD AS COUNTRY
BY SEATS 
WHERE SEATS IN (2,4,5);
ON TABLE HOLD AS HOLD2 
END

TABLE FILE HOLD1
PRINT DEALER RETAIL
BY ORDER
BY COUNTRY 
BY SEATS 
ON TABLE HOLD AS HOLD3
MORE
FILE HOLD2
END

TABLE FILE HOLD3
SUM DEALER RETAIL
BY ORDER NOPRINT
BY COUNTRY UNDER-LINE
BY SEATS 
ROWS 2 OVER 4 OVER 5
ON TABLE PCHOLD FORMAT PDF
END

October 26, 2014, 05:27 AM
Alan B
Was not happy with previous response, did not scale very well, not very neat. So using macguyver:
FILEDEF MACGUYVER MEM MACGUYVER.DAT (LRECL 3

EX -LINES *  EDAPUT MASTER, MACGUYVER, C, MEM,
FILE=MACG, SUFFIX=FIX,$
SEGNAME=ONE, $
FIELD=BLANK , , a1, a1, $
SEGNAME=TWO, PARENT=ONE, OCCURS=VARIABLE,$
FIELD=CHARACTER, ,a1, a1, $
FIELD=COUNTER, ORDER, i4, i4,$
EDAPUT*

EX -LINES * EDAPUT DATA,MACGUYVER,C,MEM, AB
EDAPUT*

JOIN BLANK WITH RETAIL_COST IN CAR TO BLANK IN MACGUYVER AS J1

DEFINE FILE CAR
BLANK/a1 WITH RETAIL_COST = '';
N_COUNTRY/a10 = IF CHARACTER EQ 'A' THEN COUNTRY ELSE 'WORLD';
END 

TABLE FILE CAR
SUM DEALER_COST AS 'Dealer Cost' RETAIL_COST AS 'Retail Cost'
BY CHARACTER NOPRINT
BY N_COUNTRY AS 'Country' SUBFOOT
" "
BY SEATS AS 'Seats'
ROWS 2 OVER 4 OVER 5
ON TABLE SET PAGE NOLEAD
ON TABLE SET NODATA 'n/a '
ON TABLE SET STYLE *
GRID=OFF,$
ENDSTYLE
END


(edit: just a check on certain options)

This message has been edited. Last edited by: Alan B,


Alan.
WF 7.705/8.007
October 31, 2014, 03:56 AM
ruhan
Thanks for the suggestions. Closing.