||Re: REPORT RENDER
Mervyn Bick <firstname.lastname@example.org>
||Sun, 16 Jul 2017 14:23:01 +0200
On 2017-07-16 11:16 AM, Mustansir Ghor wrote:
> Dear All
> I refer to report file. When we enter "set procedure to MyFishReport.rep" in the command line, then the procedure has intial below code but does not execute so does it mean it only loads that report class into memory. For that matter for any procedure.
> With do statement it actually runs the procedure. I guess so we can define r object properties within report.rep file.
> ** END HEADER -- do not remove this line
> // Generated on 16-07-17
> local r
> r = new MYFISHREPORTREPORT()
> class MYFISHREPORTREPORT of REPORT
> Best Regards
If you just want to run the report from the command line or from within
a program (or form) then
The dBASE DO command will run any .prg, .wfm or .rep file. With a .prg
file you can omit the .prg but you need to include the .wfm or .rep for
forms and windows.
You only need set procedure to.... if you want to open an instance of
the report in memory. Normally this is done by the 'bootstrap' code at
the top of the sourcecode before the class definition. If, however, you
want to, say, alter some text on the report before it is rendered then
set procedure to myfishreport.rep
This loads the sourcecode into memory. At this stage it is just sourcecode.
r = new myfishreportreport()
This creates an instance of the report in memory. The designer uses r
as a variable name to hold the instance of the form name but you can use
anything you like. In a form, for instance you might have
form.oRep = new myfishreportreport()
Now that there is an actual instance of the report in memory you can
change the properties of any object to whatever you want to
r.pagetemplate1.text1.text = 'A new heading'
r.render() (or form.oRep.render() ) will run the report with the new
text on the pagetemplate.
It may help to think of the class definition in the sourcecode as being
like the architect's plan for a house. Creating an instance of the
report by using the NEW command is like building a house from the plan.
Once the house is built you can change, say, the glass in teh windows
from plain glass to frosted glass.