|
Home > Archive > Programming with dBASE > November 2005 > simple report with row of data across pages - what am i doing wrong?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
simple report with row of data across pages - what am i doing wrong?
|
|
|
| Hi ive been trying to create a report that will let me render fields from one row of a table to different pages (i actually have a table with over 200 fields and need about 5 pages to print them all) ... i found the report example below and it works excep
t the last page of the last record won't print ... i just cant find a way to make it ... can anyone PLEASE show me how to make this report work and i will be eternally grateful.
regards
max
// Save to one file and run
set database to
close tables
if file('Ulli_M.dbf')
drop table Ulli_M
endif
create table Ulli_M (id integer,f1 char(10),f2 char(5),f3 char(5),f4 char(5))
insert into Ulli_M values (1,'First', '1a','1b','1c')
insert into Ulli_M values (2,'Second','2a','2b
','2c')
insert into Ulli_M values (3,'Third', '3a','3b','3c')
insert into Ulli_M values (4,'fourth','4a','4b
','4c')
** END HEADER -- do not remove this line
//
// Generated on 08/11/2005
//
local r
r = new MarkosRepREPORT()
r.render()
class MarkosRepREPORT of REPORT
set procedure to :ReportControls:REPO
RT.CC additive
with (this)
metric = 4 // Centimeters
endwith
this.ULLI_M1 = new QUERY()
this.ULLI_M1.parent = this
with (this.ULLI_M1)
left = -0.0265
top = -0.0265
sql = 'select * from "ulli_m.dbf"'
active = true
endwith
with (this.printer)
duplex = 1 // None
orientation = 1 // Portrait
paperSource = 15
paperSize = 9
resolution = 4 // High
color = 1 // Monochrome
trueTypeFonts = 3 // Substitute
endwith
this.PAGETEMPLATE1 = new PAGETEMPLATE(this)
with (this.PAGETEMPLATE1)
height = 10.0
width = 20.9991
marginTop = 1.905
marginLeft = 1.905
marginBottom = 1.905
marginRight = 1.905
gridLineWidth = 0
endwith
this.PAGETEMPLATE1.STREAMFRAME1 = new STREAMFRAME(this.PAGETEMPLATE1)
with (this.PAGETEMPLATE1.STREAMFRAME1)
height = 5.0
left = 0.0
top = 0.0
width = 10.0
form.STREAMFRAME1 = form.pagetemplate1.streamframe1
endwith
this.PAGETEMPLATE1.PAGENUMBER1 = new PAGENUMBER(this.PAGETEMPLATE1)
with (this.PAGETEMPLATE1.PAGENUMBER1)
left = 6.0
top = 6.0
form.PAGENUMBER1 = form.pagetemplate1.pagenumber1
endwith
this.STREAMSOURCE1 = new STREAMSOURCE(this)
with (this.STREAMSOURCE1.detailBand)
height = 6.5334
endwith
this.STREAMSOURCE1.detailBand.TEXT3 = new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TEXT3)
canRender = class::TEXT_1_CANREN
DER
height = 0.5292
left = 0.0
top = 0.0
width = 6.0
prefixEnable = false
text = {||"Begin text - Page " + form.reportPage + " - " + form.ulli_M1.rowset.fields["f1"].value.rightTrim() + " f1"}
endwith
this.STREAMSOURCE1.detailBand.TEXT4 = new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TEXT4)
canRender = class::TEXT_1_CANREN
DER
height = 0.5292
left = 0.0
top = 3.9952
width = 5.0
prefixEnable = false
text = {||"End text - Page " + form.reportPage + " - " + form.ulli_M1.rowset.fields["f1"].value.rightTrim() + " f1"}
endwith
this.STREAMSOURCE1.detailBand.TEXT6 = new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TEXT6)
canRender = class::TEXT_2_CANREN
DER
height = 0.5292
left = 0.0
top = 0.0
width = 5.0
prefixEnable = false
text = "Begin text continuation page..."
endwith
this.STREAMSOURCE1.detailBand.TEXT7 = new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TEXT7)
canRender = class::PAGE2_CANREND
ER
height = 0.5292
left = 0.0
top = 3.006
width = 5.0
prefixEnable = false
text = {||"Page " + form.reportPage + ' '+ form.ulli_M1.rowset.fields["f2"].value}
endwith
with (this.reportGroup.headerBand)
height = 0.0
endwith
with (this.reportGroup.footerBand)
height = 0.0
endwith
this.firstPageTemplate = this.form.pagetemplate1
this.form.pagetemplate1.nextPageTemplate = this.form.pagetemplate1
this.form.pagetemplate1.streamframe1.streamSource = this.form.streamsource1
this.form.streamsource1.rowset = this.form.ulli_m1.rowset
function TEXT_1_CANRENDER
//msgbox("text1-canrender")
if form.reportPage % 2 = 1
return true
else
return false
endif
return
function TEXT_2_CANRENDER
if form.reportPage % 2 = 1
this.parent.parent.beginNewFrame()
return false
else
//if form.ulli_M1.rowset.fields["f1"].value # 'fourth'
form.streamsource1.rowset.next(-1)
//endif
return true
endif
return true
function page2_CANRENDER
if form.reportPage % 2 = 0
return true
else
return false
endif
return
endclass
| |
| Marko Mihorko [dBVIPS] 2005-11-11, 11:23 am |
| Hello max!
"max" je napisal v sporočilo...
> Hi ive been trying to create a report that will let me render fields from one
> row of a table to different pages (i actually have a table with over 200
> fields and need about 5 pages to print them all) ... i found the report
> example below and it works except the last page of the last record won't
> print ... i just cant find a way to make it ... can anyone PLEASE show me how
> to make this report work and i will be eternally grateful.
Well, in that case and since it looked a bit familiar... ;-)
Below follows a copy/paste of _my_ version of this very example posted in the
newsgroups at _that_ time...
Marko Mihorko [dBVIPS]
.....
As usual mark/copy/paste/save everything below to a file named f.e. <ulli.rep>
and later on doubleclick on it under the <Reports> tab of the <Navigator>
window.
Then just navigate by clicking on the "Next Page" button on the toolbar and you
will see that the fields of one row are shown on two consecutive pages as you
wish...
......
set database to
close tables
if file('Ulli_M.dbf')
drop table Ulli_M
endif
create table Ulli_M (row char(10))
insert into Ulli_M values ('First')
insert into Ulli_M values ('Second')
insert into Ulli_M values ('Third')
insert into Ulli_M values ('Dummy')
** END HEADER -- do not remove this line
//
// Generated on 13.01.2002
//
local r
r = new MarkosRepREPORT()
r.render()
class MarkosRepREPORT of REPORT
with (this)
metric = 4 // Centimeters
endwith
this.ULLI_M1 = new QUERY()
this.ULLI_M1.parent = this
with (this.ULLI_M1)
sql = 'select * from "ulli_m.dbf"'
active = true
endwith
this.PAGETEMPLATE1 = new PAGETEMPLATE(this)
with (this.PAGETEMPLATE1)
height = 10
endwith
this.PAGETEMPLATE1.STREAMFRAME1 = ;
new STREAMFRAME(this.PAGETEMPLATE1)
with (this.PAGETEMPLATE1.STREAMFRAME1)
height = 5
width = 10
endwith
this.PAGETEMPLATE1.PAGENUMBER1 = ;
new PAGENUMBER(this.PAGETEMPLATE1)
with (this.PAGETEMPLATE1.PAGENUMBER1)
left = 6
top = 6
endwith
this.STREAMSOURCE1 = new STREAMSOURCE(this)
with (this.STREAMSOURCE1.detailBand)
beginNewFrame = true
endwith
this.STREAMSOURCE1.detailBand.TEXT3 = ;
new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TEXT3)
canRender = class::TEXT_1_CANREN
DER
width = 6
text = {||"Begin text - Page " + form.reportPage + ;
" - " + form.ulli_M1.rowset;
.fields["row"].value.rightTrim() + " row"}
endwith
this.STREAMSOURCE1.detailBand.TEXT4 = ;
new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TEXT4)
canRender = class::TEXT_1_CANREN
DER
top = 4
width = 5
text = {||"End text - Page " + form.reportPage}
endwith
this.STREAMSOURCE1.detailBand.TEXT6 = ;
new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TEXT6)
canRender = class::TEXT_2_CANREN
DER
width = 5
text = "Begin text continuation page..."
endwith
this.firstPageTemplate = this.form.pagetemplate1
this.form.pagetemplate1.nextPageTemplate = ;
this.form.pagetemplate1
this.form.pagetemplate1.streamframe1.streamSource = ;
this.form.streamsource1
this.form.streamsource1.rowset = this.form.ulli_M1.rowset
function TEXT_1_CANRENDER
if form.reportPage % 2 = 1
return true
else
return false
endif
return
function TEXT_2_CANRENDER
if form.reportPage % 2 = 1
this.parent.beginNewFrame = true
return false
else
if form.ulli_M1.rowset.fields["row"].value # 'dummy'
form.streamsource1.rowset.next(-1)
endif
return true
endif
return
endclass
| |
|
| Hi Marko
thanks for your reply ... it was your clever program i found and worked with and apologies for not acknowledging that you were the source when i posted it . I tried again with the source you sent but it wouldnt work at all (just printed the first 2 page
s) ... but if i made two small changes to your code ...
1. made the streamsource beginnewframe property false and
2. in method TEXT_2_CANRENDER, replaced
this.parent.beginNewFrame=true with
this.parent.parent.beginNewFrame()
then i could make it work to the point where it will print the 8 pages but nothing visible on the last page (page 8)!!!!
Can you see a solution? I reckon there must be one ....
Ken suggested writing 5 one page reports but this seems a bit messy - what about page numbering andif you have lots of rows and how you scroll backwards etc etc ... i would have thought what we' re trying to do here is not that unusual.
my revised version of your code is below
Any help will be really appreciated ... and i wish i understood French ...
regards
max
Marko Mihorko [dBVIPS] Wrote:
> Hello max!
>
> "max" je napisal v sporočilo...
>
Your code with my 2 revisions ...
set database to
close tables
if file('Ulli_M.dbf')
drop table Ulli_M
endif
create table Ulli_M (row char(10))
insert into Ulli_M values ('First')
insert into Ulli_M values ('Second')
insert into Ulli_M values ('Third')
insert into Ulli_M values ('Dummy')
** END HEADER -- do not remove this line
//
// Generated on 13.01.2002
//
local r
r = new MarkosRepREPORT()
r.render()
class MarkosRepREPORT of REPORT
with (this)
metric = 4 // Centimeters
endwith
this.ULLI_M1 = new QUERY()
this.ULLI_M1.parent = this
with (this.ULLI_M1)
sql = 'select * from "ulli_m.dbf"'
active = true
endwith
this.PAGETEMPLATE1 = new PAGETEMPLATE(this)
with (this.PAGETEMPLATE1)
height = 10
endwith
this.PAGETEMPLATE1.STREAMFRAME1 = ;
new STREAMFRAME(this.PAGETEMPLATE1)
with (this.PAGETEMPLATE1.STREAMFRAME1)
height = 5
width = 10
endwith
this.PAGETEMPLATE1.PAGENUMBER1 = ;
new PAGENUMBER(this.PAGETEMPLATE1)
with (this.PAGETEMPLATE1.PAGENUMBER1)
left = 6
top = 6
endwith
this.STREAMSOURCE1 = new STREAMSOURCE(this)
with (this.STREAMSOURCE1.detailBand)
beginNewFrame = false
endwith
this.STREAMSOURCE1.detailBand.TEXT3 = ;
new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TEXT3)
canRender = class::TEXT_1_CANREN
DER
width = 6
text = {||"Begin text - Page " + form.reportPage + ;
" - " + form.ulli_M1.rowset;
.fields["row"].value.rightTrim() + " row"}
endwith
this.STREAMSOURCE1.detailBand.TEXT4 = ;
new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TEXT4)
canRender = class::TEXT_1_CANREN
DER
top = 4
width = 5
text = {||"End text - Page " + form.reportPage}
endwith
this.STREAMSOURCE1.detailBand.TEXT6 = ;
new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TEXT6)
canRender = class::TEXT_2_CANREN
DER
width = 5
text = "Begin text continuation page..."
endwith
this.firstPageTemplate = this.form.pagetemplate1
this.form.pagetemplate1.nextPageTemplate = ;
this.form.pagetemplate1
this.form.pagetemplate1.streamframe1.streamSource = ;
this.form.streamsource1
this.form.streamsource1.rowset = this.form.ulli_M1.rowset
function TEXT_1_CANRENDER
if form.reportPage % 2 = 1
return true
else
return false
endif
return
function TEXT_2_CANRENDER
if form.reportPage % 2 = 1
this.parent.parent.beginNewFrame()
return false
else
if form.ulli_M1.rowset.fields["row"].value # 'dummy'
form.streamsource1.rowset.next(-1)
endif
return true
endif
return
endclass
| |
| Marko Mihorko [dBVIPS] 2005-11-14, 1:23 pm |
| Hello max!
> thanks for your reply ... it was your clever program i found and worked with
> and apologies for not acknowledging that you were the source when i posted
> it .
You are welcome ... I didn't mean at all that you had to (just notice there
my -> ;-)
> I tried again with the source you sent but it wouldnt work at all (just
> printed the first 2 pages) ... but if i made two small changes to your code
...
> then i could make it work to the point where it will print the 8 pages but
> nothing visible on the last page (page 8)!!!!
...
> my revised version of your code is below
Well, my version as well as your one are behaving _exactly the same_ for me
while running them by employing the ReportViewer object. However, I must admit
that I didn't waste any sheets of paper to check it by this means, too... ;-)
> Can you see a solution? I reckon there must be one ....
Well, check the example below which is a nice mix of all our previous versions,
indeed. ;-)
As usual mark/copy/paste/save everything below...
> Any help will be really appreciated ... and i wish i understood French ...
Well, and I wish I understood French (good enough ;-), too. <vbg>
Marko Mihorko [dBVIPS]
set database to; close tables
if file('Ulli_M.dbf'); drop table Ulli_M
endif
create table Ulli_M (f1 char(10),f2 char(5),f3 char(5))
insert into Ulli_M values ('First', '1a', '1b')
insert into Ulli_M values ('Second', '2a', '2b')
insert into Ulli_M values ('Third', '3a', '3b')
insert into Ulli_M values ('Fourth', '4a', '4b')
insert into Ulli_M values ('Fifth', '5a', '5b')
insert into Ulli_M values ('Sixth', '6a', '6b')
insert into Ulli_M values ('Seventh','7a', '7b')
insert into Ulli_M values ('Eighth', '8a', '8b')
insert into Ulli_M values ('Ninth', '9a', '9b')
insert into Ulli_M values ('Tenth', '10a','10b')
** END HEADER -- do not remove this line
//
// Generated on 14.11.2005
//
local r
r = new MarkosRepREPORT()
r.render()
class MarkosRepREPORT of REPORT
with (this)
metric = 4 // Centimeters
endwith
this.ULLI_M1 = new QUERY()
this.ULLI_M1.parent = this
with (this.ULLI_M1)
sql = 'select * from "ulli_m.dbf"'
active = true
endwith
this.PAGETEMPLATE1 = new PAGETEMPLATE(this)
with (this.PAGETEMPLATE1)
height = 10
endwith
this.PAGETEMPLATE1.STREAMFRAME1 = ;
new STREAMFRAME(this.PAGETEMPLATE1)
with (this.PAGETEMPLATE1.STREAMFRAME1)
height = 5
width = 10
endwith
this.PAGETEMPLATE1.PAGENUMBER1 = ;
new PAGENUMBER(this.PAGETEMPLATE1)
with (this.PAGETEMPLATE1.PAGENUMBER1)
left = 6
top = 6
endwith
this.STREAMSOURCE1 = new STREAMSOURCE(this)
with (this.STREAMSOURCE1.detailBand)
beginNewFrame = true
endwith
this.STREAMSOURCE1.detailBand.TEXT1 = ;
new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TEXT1)
canRender = {; return iif(form.reportPage % 2 = 0,false,true)}
width = 10
text = {||"Begin text - First page - " + form.ulli_M1.rowset;
.fields["f1"].value.rightTrim() + " row"}
endwith
this.STREAMSOURCE1.detailBand.TEXT2 = ;
new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TEXT2)
canRender = {; return iif(form.reportPage % 2 = 0,false,true)}
top = 2.5
text = {||form.ulli_M1.rowset.fields["f2"].value }
endwith
this.STREAMSOURCE1.detailBand.TEXT3 = ;
new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TEXT3)
canRender = class::TEXT_3_CANREN
DER
width = 10
text = {||"Begin text - Cont. page - " + form.ulli_M1.rowset;
.fields["f1"].value.rightTrim() + " row"}
endwith
this.STREAMSOURCE1.detailBand.TEXT4 = ;
new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TEXT4)
canRender = {; return iif(form.reportPage % 2 = 0,true,false)}
top = 2.5
text = {||form.ulli_M1.rowset.fields["f3"].value}
endwith
this.firstPageTemplate = this.form.pagetemplate1
this.form.pagetemplate1.nextPageTemplate = ;
this.form.pagetemplate1
this.form.pagetemplate1.streamframe1.streamSource = ;
this.form.streamsource1
this.form.streamsource1.rowset = this.form.ulli_M1.rowset
function render
insert into Ulli_M values ('dummy','11a','11b'
)
return super::render()
function TEXT_3_CANRENDER
if form.reportPage % 2 = 1
this.parent.beginNewFrame = true
return false
else
if form.ulli_M1.rowset.fields["f1"].value = 'dummy'
form.streamsource1.rowset.delete()
endif
form.streamsource1.rowset.next(-1)
return true
endif
return
endclass
|
|
|
|
|