Alex,
I finally got it to work. The wrapper report acts as the normal report would, by gethering properties from the parameters form and loads the appropriate data environment. In DataEnvironment.Init(), I have to following code:
IF lCancelReport
RETURN .F.
ENDIF
LOCAL ;
lcTo,;
lcReportForm,;
lcTextFile,;
lcReportStr
This.AddProperty('oDataEnvironment')
This.oDataEnvironment = CREATEOBJECT(tcDataEnvironment)
lcTo = PROGRAM(PROGRAM(-1) - 1)
lcTo = UPPER(SUBST(lcTo,RAT(".",lcTo) + 1))
lcTo = STRTRAN(lcTo,"SENDTOTEXT","")
lcReportForm = "VaccineAdministered" + tcClinicSummary
lcTextFile = lcReportForm + ".txt"
lcReportStr = "REPORT FORM " + lcReportForm + " TO " + IIF(lcTo = "FILE","FILE","PRINTER") + " " + IIF(lcTo = "FILE",lcTextFile + " ASCII","PROMPT " + IIF(lcTo = "PREVIEW","PREVIEW","NOCONSOLE"))
&lcReportStr.
RETURN .F.
Thanks for your help.
Rex
>Hi Rex,
>
>The only advantage I can see is that the wrapper report would provide the dataenvironment.
>
>A form can do the same and would be far more flexible in terms of programming, properties, events, etc.
>
>You could also use a object based on the session class (I THINK), which would also provide a private data session, if you don't want ANY user interface elements surfacing in the scenario.
>
>Alex
>
>
>>What I thought I might be able to do is use a report as a wrapper to another set of reports with the wrapper report running the dataenvironment.
>>
>>Any ideas?
>>
>>TIA
>>
>>Rex
>>
>>>Hi Rex,
>>>
>>>I don't think you can do this from the parameters form because that form is already called from within a report. It *may* be done, but it'll be tricky and not pretty.
>>>
>>>You could actually set your parameters beforehand as private variables (or local in some cases) and then run the appropriate report (i.e. create a parameters form that actually calls one or more reports).
>>>
>>>I'm currently involved in a very interesting thread that's related to this topic (Thread #
570893). You might want to take a look at the "tricks" being uncovered.
>>>
>>>I'm also in the process of writing a MMortals tip about reports and this technique... stay tuned.
>>>
>>>Good luck!
>>>
>>>Alex
>>>
>>>>All,
>>>>
>>>>I have several reports that have Summary and Detail versions. I would like to select the report version from the parameter form and have the appropriate report run. I am trying to create a blank report, with no dataenvironment, to call the correct report form based on my input, but am running into problems.
>>>>
>>>>Has anyone tried this?
>>>>Have you been successful?
>>>>How do you do it?
>>>>Is there a better way?
>>>>
>>>>TIA
>>>>
>>>>Rex