Focal Point
[SOLVED] Styling last line of a report

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

September 17, 2010, 08:40 AM
Wep5622
[SOLVED] Styling last line of a report
I have a PDF report where rows are subdivided in sections. Every section needs a border around it, with some white-space between each section.

I'm almost there! I got the borders at bottoms and tops of sections just fine, except for the last section by applying a style to the SUBHEAD, like so:
TYPE=SUBHEAD,
	BORDER-TOP=LIGHT,
	BORDER-BOTTOM=LIGHT,
$


The table doesn't have subtotals or grand totals, so I can't add a top-border to one of those to close the borders around my last section by adding a bottom border to it. Or more accurately, I'd add a top border to a next (empty) row.

I could try a trick; By comparing a section's row-count to row numbers per section it's possible to determine that a row is the last row in the section, but I'm not quite sure how to go about the row counts and it seems a rather convoluted approach (the report used to use a simpler version of such a trick though).

What I mean is this: If I'd have for example:
NR  TITLE     ROWCOUNT  SECTION
 1  Item A     5         1
 2  Item B     5
 3  Item C     5
 4  Item D     5
 5  Item E     5
 1  Item X     3         2
 2  Item Y     3
 3  Item Z     3


Then I could apply:
TYPE=DATA, COLUMN=N1, WHEN=N1 EQ N3, BORDER-BOTTOM=LIGHT,$
TYPE=DATA, COLUMN=N2, WHEN=N1 EQ N3, BORDER-BOTTOM=LIGHT,$
TYPE=DATA, COLUMN=N3, WHEN=N1 EQ N3, BORDER-BOTTOM=LIGHT,$
TYPE=DATA, COLUMN=N4, WHEN=N1 EQ N3, BORDER-BOTTOM=LIGHT,$


But then how would I get the row counts per section before actually fetching the rows?

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


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
September 17, 2010, 09:42 AM
Francis Mariani
How about creating a simple fex reading one of the sample tables to illustrate what you want to accomplish?


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
September 17, 2010, 11:09 AM
Wep5622
Well, what I want is pretty easy to visualize and I'm not familiar with the sample tables (if we even have those...). Using the data as described in my above post, the output I get is this:
  __________
 | TITLE    |
 +----------+
  __________
 | Item A   |
 | Item B   |
 | Item C   |
 | Item D   |
 | Item E   |
 +----------+
  __________
 | Item X   |
 | Item Y   |
 | Item Z   |

...footing text starts here...


As you can see, the items are grouped together per section.

The line with ___'s is the top border of each section, the line with ---'s is the bottom border. I cheated a little, as both these borders are actually applied as a style to SUBHEAD, and not to the first and last row (respectively) of DATA-items in every section.

Unfortunately, the bottom border of the last section (section 2) is missing, as there's no SUBHEAD after the last row. The end of the report should look like this:
  __________
 | Item X   |
 | Item Y   |
 | Item Z   |
 +----------+ (This border is the one I want to add)

...footing text starts here...




WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
September 17, 2010, 11:35 AM
Francis Mariani
If you have a footing, have you tried applying border-top to it?


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
September 19, 2010, 05:42 PM
Waz
This typically happens when there is a subfoot or something else like, from memory, a skipline.

It can also happen when the "section" is split across pages.

You can try Francis' suggestion.

You could also try using NOSPLIT to keep the seciton together, if its not too long.

IF you are able to create a demo of the error it will greatly help, as we can only see your representation.

The sample files are in an app folder called IBISAMP.

You can create your own on the fly as well, this has been shown many times in the forum, I typically use EDAPUT to write sample data, you could search for that.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

September 20, 2010, 09:30 AM
Wep5622
quote:
Originally posted by Francis Mariani:
If you have a footing, have you tried applying border-top to it?


Yes, I have, but there is space between the last section line and the footer.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
September 20, 2010, 09:51 AM
Wep5622
quote:
Originally posted by Waz:
This typically happens when there is a subfoot or something else like, from memory, a skipline.


I tried adding a SUBFOOT, but that way the lines at the bottom of the SUBHEAD and at the top of SUBFOOT only get printed if those items contain any data - whitespace isn't sufficient, then I get no border-lines again.

I get lines with:
TABLE FILE ...
SUM A B C
BY D
ON NAME SUBHEAD
"."
ON NAME SUBFOOT
"."
ON NAME NOSPLIT
...
TYPE=SUBHEAD,
    BORDER-BOTTOM=LIGHT,
$
TYPE=SUBFOOT,
    BORDER-TOP=LIGHT,
$


But not with (notice I replaced the dots with spaces):
ON NAME SUBHEAD
" "
ON NAME SUBFOOT
" "
ON NAME NOSPLIT


As odd as that is, I'd rather not even get the extra empty line from adding a SUBFOOT. The empty line from SUBHEAD is enough space between the sections. As said before, I can almost get it to do what I want by applying both a TOP and a BOTTOM border to the SUBHEAD (or the SUBFOOT, for that matter), but if I do that I won't get a line under the last row (or above the first row if I use SUBFOOT instead).

quote:

IF you are able to create a demo of the error it will greatly help, as we can only see your representation.

The sample files are in an app folder called IBISAMP.

You can create your own on the fly as well, this has been shown many times in the forum, I typically use EDAPUT to write sample data, you could search for that.


We don't have IBISAMP installed, so I can't help you with that. Stuff like EDAPUT is a bit beyond my grasp yet, I'm afraid. The help isn't useful there either (no surprise there), EDAPUT is not listed in the index...


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
September 20, 2010, 10:30 AM
Wep5622
I solved it!

I added a BORDER-TOP to the SUBFOOT and ditched the SUBHEAD.
With that I only needed to detect the first row of a section, which is infinitely easier than the last row (no need to keep counts or things like that).

This is the trick (with N6 being my NAME column and N15 the computed column below:
	 COMPUTE LASTNAME/A80 = LAST NAME; NOPRINT
...

DEFMACRO=COND_NEXT,
	MACTYPE=RULE,
	WHEN=N6 NE N15,
$
TYPE=DATA,
	BORDER-TOP=LIGHT,
	MACRO=COND_NEXT,
$


Basically, if the NAME from the last line doesn't match the NAME of this line, then this is the first line of a new section and we need to draw a BORDER-TOP at this row.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :