Microsoft Excel reporting and 
 data analyzing with practically no coding. 
 .Net, ActiveX, and VCL versions. 
 www.AfalinaSoft.com  

Home    Products    Downloads    Registered users    Support    Prices    Order    Primary Subscription

 

MS Office COM Add-ins. Microsoft Excel reporting 
 and data analyzing


XLReport Events - AfalinaSoft Active XL Report Programmer's Reference

<< Previous

Table of contents

Next >>


XLReport Events


AfterMasterMoveNext

Occurs in multiple-sheet reporting when the master dataset is positioned to the current record (including the first record).

Event AfterMasterMoveNext(MasterSource As XLRDatasource, _
DetailSource As XLRDatasource, Params)

In case of master-detail report as well as multiple-sheet report, you must supply the XLReport with a correct detail dataset for every record of a master dataset. Note that in case of multiple-sheet report, this event is triggered for every top-level Range-datasource on a worksheet. When Active XL Report moves to the next record of the master datasource (including the first record), it triggers this event. You have to recognize the record from the MasterSource and supply the DetailSource with an appropriate dataset. The Params contains the record number of the MasterSource if the DatasetType is xlrUnboundDatset and the Empty value in all other cases. The following example uses ADO and the Recordset.Filter property:

Private Sub ocxXLReport_AfterMasterMoveNext(ByVal MasterSource As axlr.XLRDatasource, _
ByVal DetailSource As axlr.XLRDatasource, Params As Variant)
Select Case MasterSource.Name
Case "Customers"
DetailSource.Dataset.Filter = "CustNo=" & MasterSource.Dataset.Fields("CustNo")
Case "Orders"
DetailSource.Dataset.Filter = "OrderNo=" & MasterSource.Dataset.Fields("OrderNo")
End Select
End Sub

Microsoft recommends recreating a recordset instead of using the Filter property in DAO, so:

...
Select Case MasterSource.Name
Case "Customers"
Set DetailSource.Dataset = CurrentDb.OpenRecordset( _
"Select * from orders Where CustNo=" & dsrMasterSource.Dataset("CustNo"))
...

To Microsoft Access users. Because of differences in event handling, the MasterSource and DetailSource parameters are declared as Object (and not axlr.Datasource) in the AfterMasterMoveNext event handler. We recommend using type casting for convenience, for example:

Private Sub ocxXLReport_AfterMasterMoveNext(ByVal MasterSource As Object, _
ByVal DetailSource As Object, Params As Variant)
Dim dsrMasterSource As axlr.XLRDatasource
Dim dsrDetailSource As axlr.XLRDatasource

Set dsrMasterSource = MasterSource
Set dsrDetailSource = DetailSource
...

See also: XLRDatasource class, XLRDatasource.Dataset property, XLRDatasource.MasterSourceName property, XLReport.MultisheetSourceName property, XLReport.MultisheetFieldName property.

GetDatasetInfo

Occurs when Datasource.DatasetType is xlrUnboundDataset and you don't supply the datasource with dataset both through the Datasorce.Dataset property and Datasets parameter of the Report, ReportTo, and Report2 methods.

Event GetDatasetInfo(Datasource As XLRDatasource, Params)

The Datasource input parameter contains the datasource triggering this event. You must return 2D-array describing the datasource ("field" names and types) in the Params output parameter. The array must contain N columns ("fields") in two rows: the first row contains the "field" names; the second row contains the "field" types. Available field types are listed below:

Enum DataTypes
xlrNotSupported = 0
xlrInteger = 1
xlrBoolean = 2
xlrFloat = 3
xlrDateTime = 4
xlrString = 5
End Enum

"Fields" described as xlrNotSupported are not transferred into a report.

Example:

Private Sub ocxXLReport_GetDatasetInfo(ByVal Datasource As axlr.XLRDatasource, _
Params As Variant)
Params = Array(Array("Name1", "Name2", "Name3"), _
Array(xlrInteger, xlrFloat, xlrString ))
End Sub

To Microsoft Access users. Because of differences in event handling, the Datasource parameter is declared as Object (and not axlr.Datasource) in the GetDatasetInfo event handler. We recommend using type casting for convenience, for example:

Private Sub ocxXLReport_GetDatasetInfo(ByVal Datasource As Object, Params As Variant)
Dim dsr As axlr.XLRDatasource
Set dsr = Datasource
...

See also: XLReport.GetRecord event, XLRDatasource class, XLRDatasource.Dataset property.

GetRecord

Occurs when Datasource.DatasetType is xlrUnboundDataset and you don't supply the datasource with dataset both through the Datasorce.Dataset property and Datasets parameter of the Report, ReportTo, and Report2 methods.

Event GetRecord(Datasource As XLRDatasource, RecNo As Long, Values, Eof As Boolean)

The Datasource input parameter contains the datasource triggering this event. The RecNo input parameter contains the record number (starting from 1) you are queried of. You must return 1D-array containing the record in Values parameter. In order to indicate the EOF flag, return True (-1) in the Eof parameter. Example:

Private Sub ocxXLReport_GetRecord(ByVal Datasource As axlr.XLRDatasource, _
ByVal RecNo As Long, Values As Variant, Eof As Boolean)
Eof = False
Select RecNo
Case 1
Values = Array(123, 5.5, "Hello 1")
Case 2
Values = Array(321, 3.3, "Hello 2")
Case 3
Eof = True
End Select
End Sub

This event follows the GetDatasourceInfo event.

To Microsoft Access users. Because of differences in event handling, the Datasource parameter is declared as Object (and not axlr.Datasource) in the GetRecord event handler. We recommend using type casting for convenience, for example:

Private Sub ocxXLReport_GetRecord(ByVal Datasource As Object, ByVal RecNo As Long, _
Values As Variant, Eof As Boolean)
Dim dsr As axlr.XLRDatasource
Set dsr = Datasource
...

See also: XLRDatasource.GetDatasetInfo event, XLRDatasource class, XLRDatasource.Dataset property.

<< Previous

Table of contents

Next >>



Components

axlr axlr.ocx

Data Access methods

  • ADO
  • DAO
  • RDO
  • custom data

Excel version supported

MS Excel 97 (SR2)
MS Excel 2000
MS Excel 2002 (XP)
MS Excel 2003



[ Download it ]
[ Order now ]

Copyright © 1999-2006
All right reserved.
Privacy Policy

Write to WebMaster

Page Top
Add-in Express - COM Add-ins, Smart Tags and RTDS in C#, VB, C++, J#, and Delphi