S P A C E F O L D  
data... any distance... minimal time  
 
Visual FoxPro 9.0 SP2
Understanding the Report Output Application
This page is an addendum to an existing conceptual topic, covering an enhancement in SP1.
GeneralSP1 enhancement to use of second parameter, eListenerReference
The VFP 9 Reporting System contract for any Xbase application serving as _REPORTOUTPUT  has two required parameters and some expected behavior.  To this contract, the  shipping RTM Report Output Application added an optional third parameter (eUnload) which facilitates management of reportlistener references. Beginning in SP1, the shipping Report Output Application also adds some non-required and useful behavior to its use of the second parameter, eListenerReference.

The contract does not specify what would happen if you passed an existing ReportListener reference as the second parameter and the output type did not already exist in the collection. In practice, the RTM Report Output Application ignored this reference.

Beginning in SP1, you can pass a type value and a ReportListener reference and have that reference added to the ReportOutput reference cache, with an appropriate key.

This feature provides a way to take advantage of the _oReportOutput reference collection for caching and configuring ReportListener for various custom output types, without requiring any registry mechanism. In the RTM version, you would have to manipulate the reference collection directly to do the same thing.

ExampleExample

The following code shows how you can add a reference to a new output type that you have defined. Note that you need to include the application's optional third, “reload”, parameter if you want to replace an already-existing reference in the collection.

#DEFINE RTF_TYPE 76
#DEFINE OUTPUTAPP_LOADTYPE_RELOAD 2

ox = NEWOBJECT("MyRTFListener","MyLib")
DO (_REPORTOUTPUT) WITH RTF_TYPE, ox
*_oReportOutput[TRANSFORM(RTF_TYPE)] is now your listener

REPORT FORM ? OBJECT TYPE RTF_TYPE && gives you your reference

* to replace this cache item with another listener, use reload param:
oy = NEWOBJECT("MyOtherRTFListener","MyLib")
DO (_REPORTOUTPUT) WITH RTF_TYPE, oy, OUTPUTAPP_LOADTYPE_RELOAD


See AlsoSee Also