[CLOSED]displaying multiple columns under single temporary heading
displaying sales, retail cost and dealer cost for each country and car under the column name “cost”, first the sales should be displayed for each country and car followed by the retail cost and dealer cost.This message has been edited. Last edited by: Darshan Patil,
September 05, 2018, 08:21 AM
Danny-SRL
Of course you could use OVER, but it seems to me this is not your aim. So here is a suggestion, using an "alternate master":
-SET &ECHO=ALL;
-* File darshan01.fex
DEFINE FILE CAR
-* Use same format at rcost & dcost
DSALES/D7=SALES;
END
-RUN
-* Extract sales, rcost and dcost. These fields will be placed on the same record for each country/car pair
TABLE FILE CAR
SUM DSALES DCOST RCOST
BY COUNTRY
BY CAR
ON TABLE HOLD AS DARSHAN FORMAT ALPHA
END
-RUN
-* Create an alternate master for the extract. The hierarchy maps sales, rcost and dcost to separate records
EX -LINES 8 EDAPUT MASTER,DARSHAN,C,MEM
FILENAME=DARSHAN , SUFFIX=FIX
SEGMENT=DARSHAN, SEGTYPE=S0
FIELDNAME=COUNTRY, ALIAS=E01, USAGE=A10, ACTUAL=A10, $
FIELDNAME=CAR, ALIAS=E02, USAGE=A16, ACTUAL=A16, $
SEGMENT=COST, PARENT=DARSHAN, OCCURS=VARIABLE
FIELDNAME=COST, ALIAS=E03, USAGE=D7, ACTUAL=A07, $
FIELDNAME=ORD, ALIAS=ORDER, USAGE=I2, ACTUAL=I4, $
-RUN
-* Et voila!
TABLE FILE DARSHAN
PRINT COST
BY COUNTRY
BY CAR
BY ORD NOPRINT
END
-RUN
-* If you want to have a label for each "cost", you can use a DEFINE:
DEFINE FILE DARSHAN
CNAME/A5=DECODE ORD(1 SALES 2 DCOST 3 RCOST);
END
TABLE FILE DARSHAN
PRINT COST
BY COUNTRY
BY CAR
BY ORD NOPRINT
BY CNAME
END
-RUN
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
September 05, 2018, 12:50 PM
Doug
Something like this, OVER:
TABLE FILE CAR
SUM SALES/D12C AS COST' OVER RCOST/D12C OVER DCOST/D12C
BY COUNTRY BY CAR
END
-* Like Danny said: If you want to have a label for each "cost", you can use a DEFINE.
September 05, 2018, 01:33 PM
Darshan Patil
Thanks Danny and Doug for your suggestions both of them worked.