Re: PAGE x OF y
Posted in 1997
In article <32CDCFE7.73F6@gte.net>, Douglas Wilson <dgwilson@gte.net> wrote:
>Joel Schumacher wrote:
>>
>
>> Then, there's the ugly "Secondary program". You output to a temporary
>> file, then have some secondary program that you pass the filename and
>> number of pages. It read the file, and outputs to the printer. Either at
>> n-interval lines, (or maybe you give it a specific tag to look for), it
>> outputs the "Page x of y". This is probably the best solution if the
>> number of pages is hard to calculate.
>
>It wouldn't be too hard at all to output a constant string of some sort
>as the "y" part of "Part x of y", count the # of times you
>print this then run the report output through a
>sed script to replace the constant string with the page count.
>
>Douglas Wilson
Here is a simple technique/style of building 4GL reports that allows you
to put Page 1 of X on reports. The key element is the "order by" feature
in the report function.
The following describes a technique for doing 4gl reports. The basic
idea is to send each individual item to report separately. Think SMALL.
In order to get Page 1 of X, you would need to generate approriate control
values that are sent to the report and fix the "order by" such
that the report records that are sent "LAST" are processed "FIRST"
by the report.
The LAST value sent by the loop would have to contain the number
of items/lines/whatever that you intend to use FIRST in the report.
I have done NUMEROUS reports this way. Including one that floats boxed cells
containing 3 items each both horizontally and vertically (like a spreadsheet)
and includes Page 1 of X.
Hope this idea is useful.
database patern
main
define
masterid integer,
groupid integer,
lineid integer,
colid integer,
str char(5),
wstr char(50)
create temp table rpttest (masterid integer,
groupid integer,
lineid integer,
colid integer,
str char(5))
insert into rpttest values (100,1,1,1 ,"A")
insert into rpttest values (100,1,1,20,"B")
insert into rpttest values (100,1,1,40,"C")
insert into rpttest values (100,1,1,60,"D")
insert into rpttest values (100,2,1,1 ,"E")
insert into rpttest values (100,2,1,20,"F")
insert into rpttest values (100,2,1,40,"G")
insert into rpttest values (100,2,1,60,"H")
insert into rpttest values (100,3,1,1 ,"I")
insert into rpttest values (100,3,1,20,"J")
insert into rpttest values (100,3,1,40,"K")
insert into rpttest values (100,3,1,60,"L")
insert into rpttest values (101,1,1,1 ,"a")
insert into rpttest values (101,1,1,20,"b")
insert into rpttest values (101,1,1,40,"c")
insert into rpttest values (101,1,1,60,"d")
insert into rpttest values (101,2,1,1 ,"e")
insert into rpttest values (101,2,1,20,"f")
insert into rpttest values (101,2,1,40,"g")
insert into rpttest values (101,2,1,60,"h")
start report rpt to pipe "lp -onff -dlaser4"
declare rptcur cursor for
select * from rpttest
foreach rptcur into masterid, groupid, lineid, colid, str
let wstr = str clipped, "-",
masterid using "<<&", "-",
groupid using "<<&", "-",
lineid using "<<&", "-",
colid using "<<&"
output to report rpt (masterid, groupid, lineid, colid, wstr)
end foreach
finish report rpt
end main
report rpt (masterid, groupid, lineid, colid, str)
define
masterid, groupid, lineid, colid int,
str char(50)
output
top margin 0
bottom margin 0
left margin 0
right margin 100
order by masterid, groupid, lineid, colid
format
page header
print column 25, "Test Report"
after group of masterid
print "---master---"
skip 1 line
after group of groupid
skip 1 line
# print "---group---"
after group of lineid
print ":"
on every row
print column colid, str clipped;
end report
--
Michael J. Kuhn Computer Systems Consultant phone:410-254-7060
Email: mkuhn@csd.clark.net, csd@clark.net
mkuhn@rhlab.com
c/o Baltimore Rh Typing Laboratory, Inc. phone:410-225-9595