Understanding the Report Output Application (TMM)

Visual FoxPro 9.0 SP2
This page is an addendum to an existing conceptual topic, covering an enhancement in SP1.
Back to TMM Index
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.


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.


ox = NEWOBJECT("MyRTFListener","MyLib")
*_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")

See AlsoSee Also