Subject |
Re: Preview.wfm and report printing |
From |
Ken Mayer <dbase@nospam.goldenstag.net> |
Date |
Mon, 23 Oct 2023 10:45:43 -0700 |
Newsgroups |
dbase.getting-started |
On 10/23/2023 9:32 AM, 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.
>
> function PUSHBUTTON4_onClick1
>
> if form.entryfield1.value = { - - } or
> form.entryfield2.value = { - - }
> msgbox ("Give Dates")
> else
> fdate = form.entryfield1.value
> tdate = form.entryfield2.value
>
> do preview.wfm with "printrans.rep"
>
> form.entryfield1.value = { - - } // return form
> with blank dates for next choice
> form.entryfield2.value = { - - }
> endif
> return
>
> In thereport form I use : sql select * from transfers.dbf where
> transfer => :fdat1 and tranfers <= :tdate1
> passing after RequestLive = false
> params[fdat1]= fdate
> params[tdat1]= tdate
> Active = true
>
> This works fine showing correct results in preview form, but fails on
> pressing "Print"; variable unknown .Because,I realise unfortunately,
> the print button calls the report again but the variables are no longer
> available. I then tried a simple select only, no "where" condition and
> using the example from Preview.zip. Index on transfer, using
> assocarray() and setrange() as a single parameter but it failed I
> assume because setrange() requires a rowset which is not present.
>
> if form.entryfield1.value = { - - } or form.entryfield2.value = {
> - - }
> msgbox ("Give Dates")
> else
> fdate = form.entryfield1.value
> tdate = form.entryfield2.value
> aparams = class::paramSetup()
> do preview.wfm with "printrans.rep",aParams
> endif
> return
>
> function ParamSetup()
> aparams = new assocarray()
> aparams["dates1"]= setrange(fdate,tdate) // unable to set
> address of rowset?
> return aParams
>
> 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.
Trevor -- did you look at the header code for Preview.wfm? Try opening
it in the source editor.
You need to pass the information to the *report*, and in the report's
(overridden) render method work with the values passed to the report
itself. There should be at least one example, even in an older version
of preview.wfm ...
Ken
--
*Ken Mayer*
Ken's dBASE Page: http://www.goldenstag.net/dbase
The dUFLP: http://www.goldenstag.net/dbase/index.htm#duflp
dBASE Books: http://www.goldenstag.net/dbase/Books/dBASEBooks.htm
dBASE Tutorial: http://www.goldenstag.net/dbase/Tutorial/00_Preface.htm
dBASE Web Tutorial: http://www.goldenstag.net/dbase/WebTutorial/00_Menu.htm
dBASE DOS to Windows Tutorial:
http://www.goldenstag.net/dbase/DtoWTutorial/00_Menu.htm
|
|