Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] How to add extra column to a report?
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] How to add extra column to a report?
 Login/Join
 
Member
posted
I have a following report:

 TABLE FILE CAR
SUM DC OVER
RC 
ACROSS COUNTRY
END 


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,
 
Posts: 2 | Registered: September 13, 2019Reply With QuoteReport This Post
Virtuoso
posted Hide Post
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.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2189 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Expert
posted Hide Post
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',$
 
Posts: 3004 | Location: Middle Tennessee [8204M Gen48 in Test&Prod] | Registered: February 23, 2005Reply With QuoteReport This Post
Member
posted Hide Post
This is Great!
Thank you.
 
Posts: 2 | Registered: September 13, 2019Reply With QuoteReport This Post
Virtuoso
posted Hide Post
@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', $

Big Grin


WF versions : Prod 8.2.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2189 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] How to add extra column to a report?

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.