DIMENSION aReports[1] = COMARRAY(oDll,11) nTotReports = oDll.GetReportInfo(@aReports)>This is kind of lengthy, but I'm not sure how to explain it.
HIDDEN PROCEDURE Init > > WITH This > > ** When the first instance of the DLL inits, this variable > ** array will be created. ALl other instances should be able > ** to 'see' this variable > IF TYPE("aReports") = "U" > PUBLIC aReports[1] > aReports = NULL > ENDIF > > ENDWITH > >ENDPROC>
>PROCEDURE AddReport(sAppTitle, sReportTitle, sReportFile, aTables) AS Integer > > LOCAL iElement, iTemp > iElement = 0 > > WITH This > > oReportObj = CREATEOBJECT("ReportInfo") > > oReportObj.sReportId = SYS(2015) > oReportObj.sAppTitle = sAppTitle > oReportObj.sReportTitle = sReportTitle > oReportObj.sReportFile = sReportFile > > =ACOPY(aTables, oReportObj.aTables) > > FOR iTemp = 1 TO ALEN(aReports, 1) > IF VARTYPE(aReports[iTemp ]) # "O" > iElement = iTemp > ENDIF > ENDFOR > > IF iElement = 0 > iElement = ALEN(aReports, 1) + 1 > DIMENSION aReports[iElement] > ENDIF > > aReports[iElement] = oReportObj > > RETURN iElement > > ENDWITH > >ENDPROC >>
>DIMENSION aReports[1] >nTotReports = oDll.GetReportInfo(@aReports) >>This allows the calling application to see information about reports currently
>PROCEDURE GetReportInfo(aArray) AS Variant > > LOCAL iRetVal > iRetVal = ALEN(aReports) > > ** aReports is public, and should be available to any application > ** which instantiates this DLL > =ACOPY(aReports, aArray) > > RETURN iRetVal > >ENDPROC >>
>DEFINE CLASS ReportInfo AS Session OLEPUBLIC > > sReportId = "" && Unique report Id > sAppTitle = "" && Caption to appear on the window the report is in > sReportTitle = "" && Caption to appear on the tab > sReportFile = "" && Full path and name of the report file > > DIMENSION aTables[1] && Array of table information > >ENDDEFINE >>