Subject |
Re: Preview.wfm and report printing |
From |
Mervyn Bick <invalid@invalid.invalid> |
Date |
Tue, 24 Oct 2023 15:23:59 +0200 |
Newsgroups |
dbase.getting-started |
On 2023/10/23 18:32, trevor wrote:
>
>
> Hi
> Using dBase Plus 2.21, Preview.wfm 2.22 ( early 2000's)
>
> Long time away from coding as evidence of version age.
>
> I have a form with several button calling various reports ,one of which
> I would like to choose report date ranges.
> Before I call preview it uses two entryfields " from date" and " to
> date". These values are then stored as variables.
.....
> Would it be possible in the first example to pass varriable in the sql
> "where clause" to 2nd calling of rep on print request or
>
> in 2nd : ascribe setrange() rowset to table of report . Also I'm not
> clear what is required further in report Render() method.
I hesitate to suggest trying to use the new version (2023A) of the dUFLP
in place of the version you currently use as there is almost certain to
be code which won't work with dBASE Plus 2.21. It is, however, worth
downloading the latest version and extracting preview.wfm and saving it
in the dUFLP folder to see if it works. The only problem might be that
dBASE Plus 2.21 doesn't include a reportviewer control.
Rename the exiting preview.wfm first so that you can go back to it if
the newer version of preview.wfm doesn't work.
The original preview.wfm requires changes to the report itself if you
want to pass parameters to it. The new version allows one to create an
instance of the report in memory in the launch form. This instance is
passed to preview.wfm. Because the actual report is in memory one can
pass parameters and then requery the report's query to give effect to
the changes. Instead of passing the actual .rep file to preview.wfm as
with version 2.22 one passes the instance of the report that is in
memory. Not having to overwrite the report's render() method to deal
with parameters passed via an AssocArray makes life much simpler. :-)
In your form's onOpen event handler
function form_onOpen
set procedure to :duflp:preview.wfm
form.oPreview = new PreviewForm()
form.oPreview.bModal = true //or false, your option
form.oPreview.bClose = false //or true, your option
//I normally use these settings but see the preview.wfm
//header for an explanation and change if required.
set procedure to transrep.rep
form.oRep = new transrepReport()
//If you have more than one report create individual instances
//with each one saved to a separate user-defined property.
return
function PUSHBUTTON4_onClick1
if form.entryfield1.value = { - - } or
form.entryfield2.value = { - - }
msgbox ("Give Dates")
return
else
form.oRep.transfer1.params['fdat1'] = form.entryfield1.value
form.oRep.transfer1.params['tdat1'] = form.entryfield2.value
form.oRep.transfer1.requery()
form.oPreview.viewer = form.oRep
form.oPreview.open()
form.entryfield1.value = { - - }
form.entryfield2.value = { - - }
endif
return
|
|