| Author |
Preview.wfm --- passing an SQL property for report
|
|
| Craig Cohernour 2005-12-02, 7:23 am |
| As usual, I'm probably making this more complicated than
it needs to be but all I need to do is pass the following to my
report while using preview.wfm.
sql = "select * from bartavern.dbf"
Can someone help me with setting this up.... where I need to
place what ... and so on? I looked at the notes inside preview.wfm
but I'm still missing something here.
I'm trying to use a single report with various tables depending
on what program calls it.
Thanks in advance for any assistance.
- Craig
| |
| Michael Nuwer [dBVIPS] 2005-12-02, 7:23 am |
| Craig Cohernour wrote:
> As usual, I'm probably making this more complicated than
> it needs to be but all I need to do is pass the following to my
> report while using preview.wfm.
>
> sql = "select * from bartavern.dbf"
>
> Can someone help me with setting this up.... where I need to
> place what ... and so on? I looked at the notes inside preview.wfm
> but I'm still missing something here.
>
> I'm trying to use a single report with various tables depending
> on what program calls it.
Here is how I deal with this issue:
1. In the report add a canOpen event to the query object. The code I use
is something like this:
Function Query1_canOpen
if type( "this.parent.params" ) == "O"
this.sql = 'select * from "' + ;
this.parent.params['temptable'] + '.dbf"'
else
// default table for use with designer
this.sql = 'select * from "TempTableSample.dbf"'
endif
return true
2. In my case the report contains an overriden "render" event handler,
as discussed in the header of preview.wfm. In that event handler I call
the following method:
Function setParams
form.query1.active := false
form.query1.active := true
return
(If you use duflp.crp as your base report the overriden event handler
already calles this method.)
3. Summery: setParams is called when the report is rendered. At that
point the params array has been passed to the report and the query's
canOpen handler uses the table name in the params array.
4. To call the report, I use:
cfullpath = "some table with path"
aParams = new AssocArray()
aParams[ "temptable" ] = cfullpath
set procedure to preview.wfm additive
fPreview = new PreviewForm()
fPreview.bModal = true
fPreview.params = aParams
fPreview.viewer.fileName := "SomeReport.rep"
fPreview.Open()
| |
| Todd Kreuter 2005-12-02, 7:23 am |
| Craig Cohernour wrote:
>
> As usual, I'm probably making this more complicated than
> it needs to be but all I need to do is pass the following to my
> report while using preview.wfm.
>
> sql = "select * from bartavern.dbf"
The parameters approach was the only option available to us way back
when. We now have the ability to work with the report directly:
set procedure to :duflp:preview.wfm additive
set procedure to craig.rep additive
f = new previewForm()
r = new craigReport()
// All the code in the preview.wfm overriden open method is not
// necessary, so we need to reset the open function.
f.open = FORM::Open
// Since we now have a reference to the report
// we can change anything we like
r.query1.sql = "Select * from bartavern.dbf"
// Now assign a reference to the preview.wfm viewer
f.viewer.ref = r
// Now open preview.wfm
f.open()
--
Todd Kreuter [dBVIPS]
| |
| Ken Mayer [dBVIPS] 2005-12-02, 9:23 am |
| Todd Kreuter wrote:
> Craig Cohernour wrote:
>
>
>
> The parameters approach was the only option available to us way back
> when. We now have the ability to work with the report directly:
>
> set procedure to :duflp:preview.wfm additive
> set procedure to craig.rep additive
>
> f = new previewForm()
> r = new craigReport()
>
> // All the code in the preview.wfm overriden open method is not
> // necessary, so we need to reset the open function.
>
> f.open = FORM::Open
>
>
> // Since we now have a reference to the report
> // we can change anything we like
>
> r.query1.sql = "Select * from bartavern.dbf"
>
> // Now assign a reference to the preview.wfm viewer
>
> f.viewer.ref = r
>
> // Now open preview.wfm
>
> f.open()
Feel like taking a stab at modifying the basic setup for Preview.wfm to
handle this? It's been on my mind (in the back of my mind) for awhile.
The idea being that there's a set of parameters for the form, and
altering it so that it can handle assigning the "ref" property by
passing the report object reference OR continue to function as it does
now ...? I haven't had time to delve into it.
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| Todd Kreuter 2005-12-02, 9:23 am |
| "Ken Mayer [dBVIPS]" wrote:
>
> Feel like taking a stab at modifying the basic setup for Preview.wfm to
> handle this?
I'll take a look at it. Maybe an option to pass the report file name or
report object and than acting on either.
--
Todd Kreuter [dBVIPS]
| |
| Michael Nuwer [dBVIPS] 2005-12-02, 9:23 am |
| Todd Kreuter wrote:
> "Ken Mayer [dBVIPS]" wrote:
>
>
>
> I'll take a look at it. Maybe an option to pass the report file name or
> report object and than acting on either.
>
I have already made a subclass of preview.wfm which handles this
approach. It's included below in case it might help. I did not modify
the printHTML method because I do not use it. But that modification
should be similar to the one used for the standard print button.
/*
// Create an instance of the report
set procedure to admissionList.rep additive
r = new AdmissionListReport(
)
r.query1.sql = 'select * from "'+form.qTmp.fullpath + '.dbf"'
r.query1.active = true
r.query1.rowset.indexName = "Index1"
r.PAGETEMPLATE1.MYTITLETEXT21.text = ;
form.container1.sbFromDate.value + " through ";
+ form.container1.sbToDate.value
set procedure to PreviewEX.wfm additive
f = new PreviewEXForm()
f.Viewer.ref = r
f.open()
*/
** END HEADER -- do not remove this line
//
// Generated on 07/29/2004
//
parameter bModal
local f
f = new PREVIEWEXForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class PREVIEWEXForm of previewFORM from "preview.wfm"
with (this)
open = class::OPENTHIS
readModal = class::OPENTHIS
//onOpen = class::OPENTHIS
endwith
with (this.CONTAINER1.PUSHPRINT)
onClick = class::PUSHPRINT_ONC
LICK
endwith
function OpenThis // the form
// set values based on those that might be set in the report
form.container1.collateCheckBox.value := true
form.CONTAINER1.spinStartPage.value := form.viewer.ref.StartPage
form.CONTAINER1.spinEndPage.value := form.viewer.ref.endPage
form.CONTAINER1.spinCopies.value := form.viewer.ref.printer.copies
// modify the form's text if the report has a title ...
if not empty( form.viewer.ref.title )
form.text += " ["+ form.viewer.ref.title + "]"
endif
// suggestion by Lee Camp:
class::form_onSize( null, form.width, form.height )
// deal with bClose (Cory Deurzen, vers. 2.18):
if type( "form.bClose" ) == "U" or type( "form.bClose" ) # "L"
form.bClose = true // default is to close the form
// when done printing
endif
// check bModal:
if not form.inDesign
if type( "form.bModal" ) == "U"
form.bModal = false
endif
if form.bModal
form.mdi := false // can't be true if modal
super::readModal()
else
super::open()
endif
endif
function PUSHPRINT_onClick
local oViewer, bPrinter
oViewer = form.Viewer
bPrinter = oViewer.ref.printer.ChoosePrinter()
if bPrinter
oViewer.ref.startPage = 1
oViewer.ref.output = 1 // printer
oViewer.ref.render()
oViewer.ref.output = 3 // default
endif
return
endclass
| |
| Michael Nuwer [dBVIPS] 2005-12-02, 1:23 pm |
| Todd Kreuter wrote:
> "Ken Mayer [dBVIPS]" wrote:
>
>
>
> I'll take a look at it. Maybe an option to pass the report file name or
> report object and than acting on either.
>
Here (attached) is a new "OpenThis" method. I've broken out the part
that creates a report object and placed that code into its own method.
This seems to be working ok under my tests.
I've also set a property that indicates whether a named file is used.
This value is used in "Form_OnClose" method (also below).
I am, however, having problems with the two print methods --
pushhtml_onclick and pushprint_onclick -- especially the code relating
to the multi-copies, collation loop. Any ideas on dealing with this one,
anybody?
| |
| Michael Nuwer [dBVIPS] 2005-12-02, 1:23 pm |
| Michael Nuwer [dBVIPS] wrote:
>
> I am, however, having problems with the two print methods --
> pushhtml_onclick and pushprint_onclick -- especially the code relating
> to the multi-copies, collation loop. Any ideas on dealing with this one,
> anybody?
>
Attached is a beta of preview.wfm (renamed preview2.wfm) and a prg that
can be used to test with. All seems to be working execpt collation of
multiple copies. But more testing would be good.
| |
| Ken Mayer [dBVIPS] 2005-12-02, 8:23 pm |
| Todd Kreuter wrote:
> "Ken Mayer [dBVIPS]" wrote:
>
>
>
> I'll take a look at it. Maybe an option to pass the report file name or
> report object and than acting on either.
Basically. Take a look at the startup code ...
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| Ken Mayer [dBVIPS] 2005-12-02, 8:23 pm |
| Michael Nuwer [dBVIPS] wrote:
> Michael Nuwer [dBVIPS] wrote:
>
>
> Attached is a beta of preview.wfm (renamed preview2.wfm) and a prg that
> can be used to test with. All seems to be working execpt collation of
> multiple copies. But more testing would be good.
Wow! Had some free time, eh?
The multiple copies code is a bit tricky, partially because the
choosePrinter() dialog is not receiving the number of copies, and all
that. If it did (and I have that in the wishlist or a bug report, can't
remember) it would solve some things.
Unfortunately I don't have a lot of free time right now, but am looking
forward to seeing this working ... and will try to do some work with it.
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| Bernd Hohenester 2005-12-02, 8:23 pm |
| Hello Michael,
> All seems to be working execpt collation of
> multiple copies. But more testing would be good.
you have to change the line
r.printer.copies := this.parent.spinCopies.value
to
r.printer.copies := form.CONTAINER1.spinCopies.value
and all works well.
cu
Bernd
| |
| Michael Nuwer [dBVIPS] 2005-12-03, 7:23 am |
| Ken Mayer [dBVIPS] wrote:
>
> Wow! Had some free time, eh?
A bit at the end of the week. Actually the changes didn't take much
time. Mainly adding If/EndIf tests. But the form provides the user
with many options, some of which I never use, and I have not tested all
of them.
> The multiple copies code is a bit tricky, partially because the
> choosePrinter() dialog is not receiving the number of copies, and all
> that. If it did (and I have that in the wishlist or a bug report, can't
> remember) it would solve some things.
This is one feature I have never used. Do you know whether something
like the code below would work?
r = form.viewer.ref
for i = 1 to nCopies
// start/endpage, etc.
r.startPage := form.CONTAINER1.spinStartPage.value
r.endPage := form.CONTAINER1.spinEndPage.value
r.outPut := 1 // printer
r.printer.copies := 1
try
r.render()
catch (exception e)
// do nothing
endtry
next
What is "the problem with running totals" that you are dealing with?
| |
| Michael Nuwer [dBVIPS] 2005-12-03, 7:23 am |
| Bernd Hohenester wrote:
> Hello Michael,
Hi Bernd,
Thanks for looking at this update. I'm not sure why this line is causing
a problem. I did not change anything that would affect the existing code
and object structure. But I'll look at it and pass my findings onto Ken.
>
>
>
> you have to change the line
>
> r.printer.copies := this.parent.spinCopies.value
>
> to
>
> r.printer.copies := form.CONTAINER1.spinCopies.value
>
> and all works well.
>
> cu
> Bernd
| |
| Robert Bravery 2005-12-04, 11:23 am |
| HI Craig,
As I see you have been given a ;lot of responses.
But my 2c worth.
I like to keep the the object model. As Todd has explained. This way, you
can checnge any property of any object on the report or the form.
For instance you can change the reports header if you have on as a test
object
Or you can change any object of a query, perhaps you want to institue a
filter, or a cangetrow, or anything
The trick about it, is to keep your wits about you in order to keep track of
where you are in the object model.
eg
set proc to :duflp:preview.wfm addi
pr = new previewform()
now set the report that ypou want to the report viewer object
pr.viewer.filename ="fish.rep"
and open the report
pr.open()
But if you wanted to chenge the report header that is displayed
pr = new previewform()
pr.viewer.filename = "fish.rep"
pr.viewer.ref.pagetemplate1.text4.text = "This text for the teport has
changed"
pr.open()
What happend if you want to filter a particular table in the report, it
might even have a dmd, no problem change the property of the object
pr = new previewform()
pr.viewer.filename = "fish.rep"
pr.viewer.ref.pagetemplate1.text4.text = "This text for the teport has
changed"
pr.viewer.ref.fish1.rowset.filter = "id = 1"
pr.open()
You could in fact change anything
The only problem that you have to whatch for is that the print re-renders
the report without the query filters. So what I do is change the print
button.
Robert
"Craig Cohernour" <ccohernour@charter.net> wrote in message
news:kOH5NZz9FHA.1520@news-server...
> As usual, I'm probably making this more complicated than
> it needs to be but all I need to do is pass the following to my
> report while using preview.wfm.
>
> sql = "select * from bartavern.dbf"
>
> Can someone help me with setting this up.... where I need to
> place what ... and so on? I looked at the notes inside preview.wfm
> but I'm still missing something here.
>
> I'm trying to use a single report with various tables depending
> on what program calls it.
>
> Thanks in advance for any assistance.
>
> - Craig
>
>
| |
| Craig Cohernour 2005-12-05, 7:23 am |
|
Thanks Todd. Thanks to everyone else who contributed too. Very much
appreciated.
This seems to have taken care of my request perfectly.... except I also need
to be able to run this in a modal window in a couple of instances ...
"f.readmodal()" instead of "f.open()"doesn't seem to work here ... any
suggestions for that. I get a "Variable Undefined: FILENAME" error on line
1205 and then "I need a report name!" message. (Sorry, forgot to mention
this in my original request for help.)
Thanks again.
- Craig
| |
| Michael Nuwer [dBVIPS] 2005-12-05, 7:23 am |
| Craig Cohernour wrote:
>
> I also need
> to be able to run this in a modal window in a couple of instances ...
> "f.readmodal()" instead of "f.open()"doesn't seem to work here ... any
> suggestions for that.
>
f.bModal = true
f.open()
| |
| Craig Cohernour 2005-12-05, 7:23 am |
|
Hi Robert. Yes, I do like (and have used) this method for my reports. Very
nice actually. Don't have any filters at this point but good information
for future reference. Thanks.
Any suggestions for getting this thing to work in a modal window .. it's
probably something simple I'm doing wrong. Thanks in advance.
- Craig
| |
| Craig Cohernour 2005-12-05, 7:23 am |
| Man ... you people are fast ... thanks!!
I have faith that will do it. ;-)
- C
"Michael Nuwer [dBVIPS]" <nuwermj@nospam.please.yahoo.com> wrote in message
news:ASF8IEZ%23FHA.1492@news-server...
> Craig Cohernour wrote:
>
> f.bModal = true
> f.open()
| |
| Craig Cohernour 2005-12-05, 7:23 am |
|
"Craig Cohernour" <ccohernour@charter.net> wrote in message
news:CKqvgGZ%23FHA.1492@news-server...
> I have faith that will do it. ;-)
>
Hmmm.... guess blind faith can bite .. didn't work. Anything else?
- C
| |
| Craig Cohernour 2005-12-05, 7:23 am |
| Here's the whole section where I need the modal version of the report.
set procedure to preview224.wfm additive
set procedure to mp_invoice.rep additive
f=new PreviewForm224()
r=new MP_INVOICE()
f.open = FORM::Open
r.query1.sql = "Select * from bartavern.dbf"
f.viewer.ref = r
f.bModal = true
f.open() // processing should stop here until the preview window
closes
r = null
f.release()
f = null
close procedure preview224.wfm
close procedure mp_invoice.rep
Hope this helps someone see what I'm doing wrong. Thanks folks!
- C
| |
| Michael Nuwer [dBVIPS] 2005-12-05, 7:23 am |
| Craig Cohernour wrote:
> Here's the whole section where I need the modal version of the report.
>
> set procedure to preview224.wfm additive
> set procedure to mp_invoice.rep additive
>
> f=new PreviewForm224()
> r=new MP_INVOICE()
>
> f.open = FORM::Open
>
> r.query1.sql = "Select * from bartavern.dbf"
>
> f.viewer.ref = r
> f.bModal = true
>
> f.open() // processing should stop here until the preview window
> closes
>
> r = null
> f.release()
> f = null
>
> close procedure preview224.wfm
> close procedure mp_invoice.rep
>
> Hope this helps someone see what I'm doing wrong. Thanks folks!
>
You are using Todd's originally posted code where the "open" method in
the preview form is overridden (i.e. ignored). In the preview form, this
method handles, among other things, the way the form opens (normal or
modal). But the code you are using above skips all this stuff.
The forgoing is one example of why preview.wfm needs to be updated if
one wants to use Todd's approach. Unfortunately the final update is not
ready at this time. So you have a few choices:
1. use the beta update that I have posted. It should work ok except for
collation of multiple copies. But keep in mind that it is beta code and
bugs could arise.
2. Use the subclassed previewEX.wfm that I posted. This form overrides
some of the methods in preview.wfm, replacing those methods with
alternative handling routines. In this case you will need to supplement
the openThis and printing methods if you have particular needs that are
not currently handled by the subclasses.
3. Use the original version of preview and see my first reply to your
message. There you will find the code to archive your goal in accordance
to the way preview.wfm was designed. (Not using Todd's approach, that is).
4. Finally, you could re-work preview.wfm yourself such that it meets
your needs. That is what Robert has done.
| |
| Todd Kreuter 2005-12-05, 7:23 am |
| Craig Cohernour wrote:
>
> Any suggestions for getting this thing to work in a modal window .. it's
> probably something simple I'm doing wrong. Thanks in advance.
With out looking at the code, I'm just going to make a guess (will look
into later today)
f = new previewForm()
f.mdi = false
f.readmodoal = form::readmodal
f.readModal()
--
Todd Kreuter [dBVIPS]
| |
| Todd Kreuter 2005-12-05, 7:23 am |
| "Michael Nuwer [dBVIPS]" wrote:
>
> I have already made a subclass of preview.wfm which handles this
> approach.
I see you have done some work on this ;-) Will try and get caught up
with it today and have a look.
--
Todd Kreuter [dBVIPS]
| |
| Craig Cohernour 2005-12-05, 9:23 am |
|
"Todd Kreuter" <tkreuter@dbvips.usa> wrote in message
news:4394370F.837162F5@dbvips.usa...
> With out looking at the code, I'm just going to make a guess (will look
> into later today)
>
> f = new previewForm()
> f.mdi = false
> f.readmodoal = form::readmodal
>
> f.readModal()
>
Good guess. Thanks again Todd. I think I'm actually starting to catch on
too... ;)
- Craig
| |
| Ken Mayer [dBVIPS] 2005-12-05, 9:23 am |
| Michael Nuwer [dBVIPS] wrote:
> This is one feature I have never used. Do you know whether something
> like the code below would work?
>
> r = form.viewer.ref
> for i = 1 to nCopies
> // start/endpage, etc.
> r.startPage := form.CONTAINER1.spinStartPage.value
> r.endPage := form.CONTAINER1.spinEndPage.value
> r.outPut := 1 // printer
> r.printer.copies := 1
> try
> r.render()
> catch (exception e)
> // do nothing
> endtry
> next
>
> What is "the problem with running totals" that you are dealing with?
>
Running totals don't get cleared with the report. So if you preview the
report, then go to a new page, the totals are regenerated, but not
cleared, and the totals are added again, and everything is off. Example,
let's say you use the fish table, and for whatever reason do a total on
the Length CM field, as a running total (it shows the total for each
break, which would most likely be each row). You have each fish on a new
page (group by name, set the property in the group headerBand to start
on a new page for each group). Run the report. Go to view a new page.
The total has been recalculated, because the report is re-generated, but
the totals have not been set to zero before re-rendering.
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| Michael Nuwer [dBVIPS] 2005-12-05, 9:23 am |
| Craig Cohernour wrote:
>
>
> Good guess. Thanks again Todd. I think I'm actually starting to catch on
> too... ;)
Have you tried printing the report? Does the output respect the
conditions have set?
| |
| Michael Nuwer [dBVIPS] 2005-12-05, 11:23 am |
| Ken Mayer [dBVIPS] wrote:
>
> Running totals don't get cleared with the report. So if you preview the
> report, then go to a new page, the totals are regenerated, but not
> cleared, and the totals are added again, and everything is off. Example,
> let's say you use the fish table, and for whatever reason do a total on
> the Length CM field, as a running total (it shows the total for each
> break, which would most likely be each row). You have each fish on a new
> page (group by name, set the property in the group headerBand to start
> on a new page for each group). Run the report. Go to view a new page.
> The total has been recalculated, because the report is re-generated, but
> the totals have not been set to zero before re-rendering.
Thanks, I'll have a closer look when I find some extra time. (Not likely
to be today.)
| |
| Ken Mayer [dBVIPS] 2005-12-05, 11:23 am |
| Michael Nuwer [dBVIPS] wrote:
> Ken Mayer [dBVIPS] wrote:
>
>
>
> Thanks, I'll have a closer look when I find some extra time. (Not likely
> to be today.)
No problem. I was thinking on this after posting, and perhaps a running
total with the value set to zero in an overridden Render() method?
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| Todd Kreuter 2005-12-05, 11:23 am |
| "Ken Mayer [dBVIPS]" wrote:
>
> Michael Nuwer [dBVIPS] wrote:
>
> No problem. I was thinking on this after posting, and perhaps a running
> total with the value set to zero in an overridden Render() method?
What do you mean by a running total? The totals by group or report
group, or something else?
--
Todd Kreuter [dBVIPS]
| |
| Todd Kreuter 2005-12-05, 8:24 pm |
| "Michael Nuwer [dBVIPS]" wrote:
>
> Craig Cohernour wrote:
>
>
> Have you tried printing the report? Does the output respect the
> conditions have set?
Print? No one said anyting about printing ;-)
--
Todd Kreuter [dBVIPS]
| |
| Todd Kreuter 2005-12-05, 8:24 pm |
| "Michael Nuwer [dBVIPS]" wrote:
>
> I am, however, having problems with the two print methods --
> pushhtml_onclick and pushprint_onclick -- especially the code relating
> to the multi-copies, collation loop. Any ideas on dealing with this one,
> anybody?
I've probably done more than I should have, but I went ahead rewote most
of the preview.wfm code, including a new bootstap section to accept
either a report file name or a report object. I eliminated the use of
any second report instance and all seems to work as expected. Need to
check on the running total error Ken mentions.
I left all the prior code intact, commenting out entire blocks of code
not used or moved elsewhere. I did use a storage object (store) to store
report settings. This was easier for me to keep track of things. Its
sort of a buffer between the user controls and the report. Anyways that
level can be taken out at somepoint (might be confusing to others).
--
Todd Kreuter [dBVIPS]
| |
| Todd Kreuter 2005-12-05, 8:24 pm |
| Todd Kreuter wrote:
>
I forgot, posted in the binaries ng...
--
Todd Kreuter [dBVIPS]
| |
| Ken Mayer [dBVIPS] 2005-12-05, 8:24 pm |
| Todd Kreuter wrote:
> "Ken Mayer [dBVIPS]" wrote:
>
>
>
> What do you mean by a running total? The totals by group or report
> group, or something else?
>
Totals you create in your code in the canRender event of text controls
for a detail or group band ...
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| Craig Cohernour 2005-12-06, 7:23 am |
| Well, you just had to mention that didn't you ... as soon as I send it to
print I get:
Variable undefined: BCLOSE
line 1130 of preview.wfm
"Michael Nuwer [dBVIPS]" <nuwermj@no.spam.yahoo.com> wrote in message
news:fHS8eba%23FHA.1228@news-server...
> Have you tried printing the report? Does the output respect the
> conditions have set?
| |
| Michael Nuwer [dBVIPS] 2005-12-06, 11:23 am |
|
Hi Todd, Thanks for the updated form. As always its a pleasure to read
your code. Personally I like the storage object. When I get some time I
will do some testing with the form. Compatibility with old techniques
will be important for generalized use. In particular the handling of the
params array and the custom report "duflp.crp". As far as the status of
this form and the dUFLP, that's up to Ken.
Ken: One thing you might consider, when you have time to think about
such things <g>, is to leave the current preview.wfm form as is; And
include Todd's form as an alternative in the dUFLP.
Todd Kreuter wrote:
> "Michael Nuwer [dBVIPS]" wrote:
>
>
>
> I've probably done more than I should have, but I went ahead rewote most
> of the preview.wfm code, including a new bootstap section to accept
> either a report file name or a report object. I eliminated the use of
> any second report instance and all seems to work as expected. Need to
> check on the running total error Ken mentions.
>
> I left all the prior code intact, commenting out entire blocks of code
> not used or moved elsewhere. I did use a storage object (store) to store
> report settings. This was easier for me to keep track of things. Its
> sort of a buffer between the user controls and the report. Anyways that
> level can be taken out at somepoint (might be confusing to others).
>
| |
| Ken Mayer [dBVIPS] 2005-12-06, 1:23 pm |
| Michael Nuwer [dBVIPS] wrote:
>
> Hi Todd, Thanks for the updated form. As always its a pleasure to read
> your code. Personally I like the storage object. When I get some time I
> will do some testing with the form. Compatibility with old techniques
> will be important for generalized use. In particular the handling of the
> params array and the custom report "duflp.crp". As far as the status of
> this form and the dUFLP, that's up to Ken.
>
> Ken: One thing you might consider, when you have time to think about
> such things <g>, is to leave the current preview.wfm form as is; And
> include Todd's form as an alternative in the dUFLP.
What I was hoping was to just replace the old Preview form with the new
one, but backward compatability is vital for that to work. In other
words, I can't have this breaking older code ... (my own included <g> ).
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| Craig Cohernour 2005-12-06, 1:23 pm |
| Easy enough .. .just have to set it before the report is run.
| |
| Todd Kreuter 2005-12-06, 8:24 pm |
| "Michael Nuwer [dBVIPS]" wrote:
>
> Hi Todd, Thanks for the updated form. As always its a pleasure to read
> your code. Personally I like the storage object. When I get some time I
> will do some testing with the form. Compatibility with old techniques
> will be important for generalized use. In particular the handling of the
> params array and the custom report "duflp.crp". As far as the status of
> this form and the dUFLP, that's up to Ken.
Thanks Michael,
There was some old code dealing with the source alias' included with the
report file name when run in runtime. I guess it was stripping the
source alias from the string. I did not include that part.
Then there is the issue of the running totals Ken mentions. Still a bit
foggy on what exactly that is.
Other than that, the new code should be backward compatible with the
old.
--
Todd Kreuter [dBVIPS]
| |
| Todd Kreuter 2005-12-06, 8:24 pm |
| "Ken Mayer [dBVIPS]" wrote:
>
> What I was hoping was to just replace the old Preview form with the new
> one, but backward compatability is vital for that to work. In other
> words, I can't have this breaking older code ... (my own included <g> ).
Yes, that was my intention. Except for a couple unresolved issues, it
should be backward compatible.
--
Todd Kreuter [dBVIPS]
| |
| Todd Kreuter 2005-12-06, 8:24 pm |
| "Ken Mayer [dBVIPS]" wrote:
>
> Totals you create in your code in the canRender event of text controls
> for a detail or group band ...
So these are not ag* functions? Still a bit unclear.
--
Todd Kreuter [dBVIPS]
| |
| Todd Kreuter 2005-12-06, 8:24 pm |
| Todd Kreuter wrote:
>
> There was some old code dealing with the source alias' included with the
> report file name when run in runtime. I guess it was stripping the
> source alias from the string. I did not include that part.
Correction, that was being done when NOT in runtime. The code is
stripping the source alias part from the passed report file name and
substituting the path. In my tests with the new code which excludes the
above mentioned code and some other code that dealt with spaces and
quotes in the file name, I passed a report file name which included
spaces, a single quote, and a source alias without problem. Can anyone
shed some light on the above code, perhaps something not working in a
prior version of dBASE?
--
Todd Kreuter [dBVIPS]
| |
| Ken Mayer [dBVIPS] 2005-12-07, 9:23 am |
| Todd Kreuter wrote:
> "Ken Mayer [dBVIPS]" wrote:
>
>
>
> So these are not ag* functions? Still a bit unclear.
No. These are running totals that are created in your own code in the
canRender event of the report. I discuss these in much detail in the
papers on reports, and I believe at least some of those discussions are
in my book. <g> If necessary I will try to throw together an example ...
let me know.
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| Michael Nuwer [dBVIPS] 2005-12-07, 8:24 pm |
| Ken Mayer [dBVIPS] wrote:
>
> No. These are running totals that are created in your own code in the
> canRender event of the report. I discuss these in much detail in the
> papers on reports, and I believe at least some of those discussions are
> in my book. <g> If necessary I will try to throw together an example ...
> let me know.
I put a demo of this issue in the binaries group.
| |
| Todd Kreuter 2005-12-07, 8:24 pm |
| "Michael Nuwer [dBVIPS]" wrote:
>
> I put a demo of this issue in the binaries group.
Ah, had never done that before.
This should be an easy fix by reseting the accumulator, perhaps in the
text's canRender event like:
if this.form.reportPage = 1
accumulator = 0
endif
Because of the way the report class always starts rendering at page 1
whenever it goes backwards or you have to jump to another page, this
should work. In my tests it works. Anyone else?
--
Todd Kreuter [dBVIPS]
| |
| Ken Mayer [dBVIPS] 2005-12-07, 8:24 pm |
| Michael Nuwer [dBVIPS] wrote:
> Ken Mayer [dBVIPS] wrote:
>
>
>
> I put a demo of this issue in the binaries group.
The important thing to note is that while printing it once it comes out
okay, printing it twice causes problems unless you create a new instance
of the report ... re-rendering it continues adding the totals where they
left off ...
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| Ken Mayer [dBVIPS] 2005-12-07, 8:24 pm |
| Todd Kreuter wrote:
> "Michael Nuwer [dBVIPS]" wrote:
>
>
>
>
> Ah, had never done that before.
>
> This should be an easy fix by reseting the accumulator, perhaps in the
> text's canRender event like:
>
> if this.form.reportPage = 1
> accumulator = 0
> endif
>
> Because of the way the report class always starts rendering at page 1
> whenever it goes backwards or you have to jump to another page, this
> should work. In my tests it works. Anyone else?
Hmm. A quick test on something I was going to throw together as an
example if needed shows that as working ... that was too easy. <g> Where
were you when I wrote that stuff in the Knowledgebase? <gggg>
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| Todd Kreuter 2005-12-07, 8:24 pm |
| "Ken Mayer [dBVIPS]" wrote:
>
> Hmm. A quick test on something I was going to throw together as an
> example if needed shows that as working ... that was too easy. <g> Where
> were you when I wrote that stuff in the Knowledgebase? <gggg>
I don't know, I remember you mentioning that way back when working with
preview.wfm, but I guess I did'nt quite understand the problem. ;-)
I'm cleaning up the form I posted. One question, if you are viewing one
page, then go to print another page and return to the form (not close
form), should the view return to the page that was viewed or the first
or last page that was printed?
--
Todd Kreuter [dBVIPS]
| |
| Ken Mayer [dBVIPS] 2005-12-08, 9:23 am |
| Todd Kreuter wrote:
> "Ken Mayer [dBVIPS]" wrote:
>
>
>
> I don't know, I remember you mentioning that way back when working with
> preview.wfm, but I guess I did'nt quite understand the problem. ;-)
Well, I wrote the initial Preview.wfm back when I was working at
Borland, and had Charles Overbeck (who wrote the original report engine)
there to help me figure things out ... but some things just weren't
obvious, and his approach left a lot to be desired (see my wishlist
request for a 'keep group together' option ...).
> I'm cleaning up the form I posted. One question, if you are viewing one
> page, then go to print another page and return to the form (not close
> form), should the view return to the page that was viewed or the first
> or last page that was printed?
I would expect it to return to the page it was viewing ... but that's
me. <g>
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
| |
| Todd Kreuter 2005-12-08, 9:23 am |
| "Ken Mayer [dBVIPS]" wrote:
>
> Well, I wrote the initial Preview.wfm back when I was working at
> Borland, and had Charles Overbeck (who wrote the original report engine)
> there to help me figure things out ... but some things just weren't
> obvious, and his approach left a lot to be desired (see my wishlist
> request for a 'keep group together' option ...).
;-)
I saw the wish. I have option built into my custom controls. It takes
into account any headerBand, the nubmer of detail rows in the group, and
the footerBand. But as you know, if the band height varies from one
group to the next (heights are calcuated the first time the bands
render) your not going to get consistent results.
> I would expect it to return to the page it was viewing ... but that's
> me. <g>
I just posted an updated version which currently returns to the first
page printed. That can be changed.
--
Todd Kreuter [dBVIPS]
| |
| Ken Mayer [dBVIPS] 2005-12-08, 8:23 pm |
| Todd Kreuter wrote:
> "Ken Mayer [dBVIPS]" wrote:
>
>
>
> ;-)
>
> I saw the wish. I have option built into my custom controls. It takes
> into account any headerBand, the nubmer of detail rows in the group, and
> the footerBand. But as you know, if the band height varies from one
> group to the next (heights are calcuated the first time the bands
> render) your not going to get consistent results.
That's what makes me nuts about this one report. I've tried doing the
internal calculations and can't get one that does the trick -- either it
kicks something to the next streamFrame that shouldn't, or it displays
the group headerBand at the bottom of the streamFrame with no detail. Sigh.
>
>
> I just posted an updated version which currently returns to the first
> page printed. That can be changed.
Tough call ...
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/dbase/dBASEBook.htm
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase
|
|
|
|