Chaining listeners in VFP 9.0

The instances of the XFRXListener class can be chained together as well as with other report listeners so that multiple output formats could be generated by one REPORT command. The following example creates XFRXListener objects for HTML and PDF documents and chains them together with FFC’s UpdateListener to display a progress bar during the report execution. This approach ensures that the HTML and PDF documents will contain exactly the same output (if there were two successive report runs, the data could have been modified).

LOCAL m.loObj, m.loObj2, m.loObj3
m.loObj = xfrx("XFRX#INIT")
m.loObj.targetType = "HTML"
m.loObj.targetFileName = "invoices.htm"
     
m.loObj2 = xfrx("XFRX#INIT")
m.loObj2.targetType = "PDF"
m.loObj2.targetFileName = "invoices.pdf"
m.loObj.successor = m.loObj2
     
m.loObj3 = NEWOBJECT("updatelistener", "_reportlistener.vcx")
m.loObj3.thermFormCaption = "Report in progress ..."
m.loObj2.successor = m.loObj3
 
REPORT FORM myReport OBJECT m.loObj