>Is it Possible to pass parameters to VFP report?
>Note:- I don't want to use public variables.
I usually use a wrapper program that I can use to get parameters from a user and then have them available to a report. A simple example would
be;
PROCEDURE TheReport
PRIVATE pdStartDate, pdEndDate
pdStartDate = { / / }
pdEndDate = DATE()
oParamForm = CREATEOBJECT("someform to get start/end date parameters")
=GetRptParams()
=DoRpt()
RETURN
PROCEDURE GetRptParams
oParamForm.txtStartDate.ControlSource = "pdStartDate"
oParamForm.txtEndDate.ControlSource = "pdEndDate"
oParamForm.Show(1)
RETURN
PROCEDURE DoRpt
SELECT * ;
FROM sometable ;
WHERE BETWEEN(somedate,pdStartDate,pdEndDate) ;
INTO CURSOR RptCursor
IF _TALLY > 0
REPORT COMMAND
ENDIF
USE
RETURN
The report definition usually will have in it's header a label and
textbox that has the following; From pdStartDate To pdEndDate
Because pdStartDate and pdEndDate were defined as Private in the wrapper
program, they are visible to the report definition. And when this
program ends, they are destroyed, no publics are used and no app
properties are needed.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement