Using VSView Reporting Edition > Advanced Topics > Custom Data Sources > Custom Recordsets |
For the ultimate in data source customization, you can implement your own data source object. This option is indicated in situations where:
Your data is already loaded in memory.
Some or all of the data is calculated on demand, and does not even exist until you request it.
The data comes from disparate data sources and you do not have an easy way to create a standard recordset from it.
To implement your own data source object, you need to create a COM object that implements the IVSReportRecordset interface. This interface contains the following methods:
Method |
Description |
---|---|
GetFieldCount() As Long |
Returns the number of fields. |
GetFieldName(Index As Long) As String |
Returns the name of the ith field. |
GetFieldType(Index As Long) As Long |
Returns the type of the ith field.* |
GetFieldSize(Index As Long) As Long |
Returns the size of the ith field.* |
GetFieldValue(Index As Long) As Variant |
Returns the value of the ith field in the current record. |
BegOfFile() As Boolean |
Returns True if the cursor is at the first record. |
EndOfFile() As Boolean |
Returns True if the cursor is positioned beyond the last record. |
MoveFirst() |
Moves the cursor to the first record. |
MoveLast() |
Moves the cursor to the last record. |
MovePrevious() |
Moves the cursor to the previous record. |
MoveNext() |
Moves the cursor to the next record. |
GetBookmark() As Variant |
Returns a marker that uniquely identifies the current record. |
SetBookmark(BookMark As Variant) |
Moves the cursor to the position identified by the BookMark parameter. |
ApplyFilter(Filter As String) |
Applies a filter expression to the recordset.** |
ApplySort(Sort As String) |
Applies a sort expression to the recordset. The expression has the same format as a WHERE clause in a SQL statement.** |
* Field types and sizes are not used internally by VSReport8. This information is used only to fill the array returned by the FieldInfo property.
** You do not have to implement filtering and sorting. If you simply provide do-nothing stubs for these functions, you will still be able to generate reports from your recordsets, except the Filter and Sort properties will not work.