Focal Point
[SOLVED] Customize Header and subtotal

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

June 29, 2012, 06:56 PM
sxschech
[SOLVED] Customize Header and subtotal
Would like to find out how I could conditionally change the wording of a subtotal. For example on the subtotal line, it currently shows

*TOTAL W GERMANY

can I conditionally change it to

*TOTAL WEST GERMANY

without it affecting the detail rows? (meaning that in the detail section it would still show W GERMANY). For my actual report, the detail section shows a single digit code in the detail and I would like to translate that on the subtotal line to display a fuller description.

I've been trying to search and read about this and seems like I would have to use a sub footer instead, but hoping I don't have to code it as still new territory. If I do, would like to know how to line up the totals with the detail as there are 11 cols for subtotals and totals in the actual report. The sample contains 3, so hopefully is enough for me to get the idea.

For the report heading, I would like to have something like the following (including a variable in part of the header "amperREGION_HDR"):

---for some reason the amper symbol and region are not rendering properly on my browser, hope it doesn't impact the example. ---

  
--------------------------------------------------------------
-Run Date 06/29/12          Title1          Page 1           -
-Run Time 06:10:08          Title2          Program ID ABC   -
-                           amperREGION_HDR                  -
-                                                            -
- COUNTRY CAR   CARSOLD   SALES  DEALER COST                 -
- ENGLAND JAGUAR      0   12000  18,621                      -
 


Alignments of the above heading using the first row as an example:
"Run Date" flush left, "Title" centered "Page 1" near right edge of page

-DEFAULT ®ION = 'FOC_NONE'
-SET &OC='OPEN NOBREAK';
-SET &OPR='NE';
-REPEAT CARLOOP 2 TIMES
-SET ®ION_HDR = IF ®ION EQ '_FOC_NULL' THEN 'All Regions' ELSE ®ION;
DEFINE FILE CAR
REGION/A20=IF COUNTRY EQ 'ENGLAND' OR COUNTRY EQ 'JAPAN' THEN 'ISLAND' ELSE 'MAINLAND';
END
TABLE FILE CAR
SUM
     COMPUTE CARSOLD/I3 = SALES / DEALER_COST;
	 SALES
	 DEALER_COST
BY  LOWEST REGION NOPRINT
BY  LOWEST COUNTRY
BY  LOWEST CAR

ON COUNTRY SUBTOTAL AS '*TOTAL'
HEADING
"®ION_HDR"
WHERE REGION EQ '®ION.(<ALL,_FOC_NULL>,<MAINLAND,MAINLAND>,<ISLAND,ISLAND>).REGION.';
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE COLUMN-TOTAL AS 'TOTAL'
ON TABLE PCHOLD FORMAT HTML &OC
-*ON TABLE PCHOLD FORMAT PDF &OC
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = endeflt,
$
ENDSTYLE
END
-RUN
-SET &OC='CLOSE';
-SET &OPR='EQ';
-SET ®ION = 'MAINLAND';
-CARLOOP
-ENDREPEAT
 

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


WebFocus 7.7.03
Win7, all output
June 29, 2012, 08:06 PM
Dan Satchell
To change your subtotal text, you will need to use SUBFOOT. SUBTOTAL does not provide any means to change the values used in the text. To align your SUBFOOT values, use the StyleSheet parameter HEADLIGN=BODY and use spot markers <+0> in the SUBFOOT, if necessary, to skip columns and correctly position the items in the report.

There are at least two ways to create your headings. First, DEFINE heading fields that contain the entire heading row, including the correct number of spaces between items and then use setting SHOWBLANKS=ON to force WF to honor the spaces between items in the headings. Second, specify your headings as usual and then use StyleSheet parameters HEADALIGN=BODY, COLSPAN, LINE, and OBJECT to line up the heading items with specific columns in the report. Both of these methods will require a fair amount of trial and error. It may actually be easier to do this in the painter.


WebFOCUS 7.7.05
June 30, 2012, 02:06 PM
Danny-SRL
This should help with the name change at SUBTOTAL time:
  
-* File sx01.fex
DEFINE FILE CAR
XCOUNTRY/A16=DECODE COUNTRY(
ENGLAND 'GREAT BRITAIN' 
FRANCE 'LUTECE' 
ITALY 'ROMAN' 
JAPAN 'NIPPON' 
'W GERMANY' 'WEST GERMANY' 
ELSE 'OTHER');
END
TABLE FILE CAR
SUM SALES
BY COUNTRY
BY XCOUNTRY NOPRINT
BY CAR
ON XCOUNTRY SUBTOTAL AS 'Total'
END



Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

July 02, 2012, 04:34 PM
Dan Satchell
@ Daniel: Thank you for dismissing my SUBFOOT nonsense with your clear example of how to alter SUBTOTAL text.


WebFOCUS 7.7.05
July 02, 2012, 06:18 PM
sxschech
Thank you Daniel (Danny-SRL) for the decode suggestion. I eventually got it to work as it wasn't as simple to implement for my particular report because I had to do a compute and several defines. Too bad it's not like MS-Access where I can redefine a field at the point where it displays rather than having to do it elsewhere and in many places.

Dan Satchel, I've been trying your suggestion and since I am not familiar with understanding how to code styles, the results were looking horrible. At first, the output was all over the place. Eventually I went back and forth between using the report painter and the code view and was able to get something reasonable.


[update:] I thought it looked ok, but when I resized the browser window or tried to print, the header wrapped in such a way that it was unreadable. I tried printing to PDF instead of html, which keeps the positioning fine, but the point size increased (looks like 12 or 14) and because of that, the remaining cols of the report do not fit on one page. I have been unable to figure out how to get the point size to show up as 9 when output to pdf or if it is possible to scale down the report as can be done in some other programs.


Thank you both for your help, appreciate it very much.

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


WebFocus 7.7.03
Win7, all output