Subject Preview.wfm and report printing
From trevor <bob@bob.com>
Date Mon, 23 Oct 2023 12:32:29 -0400
Newsgroups dbase.getting-started



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.

Thanks,  Trevor