I need to add an extra column on the right for example "NOTES". It will contain some hard coded alpha characters that correspond to each of the rows. So for DEALER_COST, it would be something like 'ddddd' and for RETAIL_COST it would be 'rrrrr'
the output would look something like:
COUNTRY
ENGLAND FRANCE ITALY JAPAN W GERMANY NOTES
DEALER_COST 37,853 4,631 41,235 5,512 54,563 ddddd
RETAIL_COST 45,319 5,610 51,065 6,478 64,732 rrrrr
I was provided with McGyver technique. But was hoping for something simpler.
Thank you.This message has been edited. Last edited by: nickz,
September 17, 2019, 07:52 AM
MartinY
This could be one way from several options. As per example, you may use dynamic format instead of FPRINT function The challenge is regarding the fact that your final output is using the ACROSS with the Note at the right. So, it need to be "manually" placed there Also you need to mix numeric and alpha data in the measures section of the report
TABLE FILE CAR
SUM COMPUTE RC/A10 = FPRINT(RETAIL_COST, 'D7', 'A10');
COMPUTE DC/A10 = FPRINT(DEALER_COST, 'D7', 'A10');
BY TOTAL COMPUTE COLID /I2 = 1;
BY COUNTRY
ON TABLE HOLD AS TMP1
END
-RUN
TABLE FILE CAR
SUM COMPUTE RC/A10 = 'rrrrr';
COMPUTE DC/A10 = 'ddddd';
BY COUNTRY NOPRINT
BY TOTAL COMPUTE COLID /I2 = 99;
BY TOTAL COMPUTE COUNTRY /A10 = 'NOTES';
WHERE READLIMIT EQ 1;
WHERE RECORDLIMIT EQ 1;
ON TABLE HOLD AS TMP2
END
-RUN
TABLE FILE TMP1
SUM RC
DC
BY COLID
BY COUNTRY
ON TABLE HOLD AS RPTDATA
MORE
FILE TMP2
END
-RUN
TABLE FILE RPTDATA
SUM DC AS 'Dealer Cost' OVER
RC AS 'Retail Cost'
ACROSS COLID NOPRINT
ACROSS COUNTRY AS 'Country'
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
TYPE=DATA,
ACROSSCOLUMN=DC,
JUSTIFY=RIGHT,
$
TYPE=DATA,
ACROSSCOLUMN=RC,
JUSTIFY=RIGHT,
$
ENDSTYLE
END
-RUN
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
September 17, 2019, 10:55 AM
Doug
NICE! That's definitely 'Thinking Outside The Box'...
I just enhanced the 'Already Successful' code by changing the 'TYPE=DATA' lines as follows (during my analysis of your code, building on your success):
TYPE=DATA, JUSTIFY=RIGHT, $
TYPE=DATA, ACROSSCOLUMN=DC, JUSTIFY=LEFT, WHEN = DC GE 'A',$
TYPE=DATA, ACROSSCOLUMN=RC, JUSTIFY=LEFT, WHEN = RC GE 'A',$
September 17, 2019, 01:57 PM
nickz
This is Great! Thank you.
September 17, 2019, 02:15 PM
MartinY
@nickz,
My pleasure to have been able to help you
Update your first post by adding [SOLVED] at the beginning of the subject
@Doug,
I'll go further. Since by default WF is left justifying characters (alpha) string, your enhancement may only be
TYPE=DATA, ACROSSCOLUMN=DC, JUSTIFY=RIGHT, WHEN = DC LT 'A', $
TYPE=DATA, ACROSSCOLUMN=RC, JUSTIFY=RIGHT, WHEN = RC LT 'A', $
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007