You can take data from any source such as a database, data stream, or flat file, and then at run time you can manipulate and apply it to a report. Data is retrieved using a Rowset object and stored in a DataSet object.
|
|
|
If you create a report that is based on a DataSet object, the data that is used is not automatically saved with the report. To populate the report with data the next time you open it, you must either re-apply the data source to see current data, or access a saved version of the data source for preview. |
|
Visual Basic |
|
|
Dim rowsetMD As New RowsetMetaData() |
|
|
C# |
|
|
RowsetMetaData rowsetMD = new RowsetMetaData(); |
|
In this example the RowsetMetaData object is populated with result fields from the report. Any Field object can be used to populate the RowsetMetaData.
|
Visual Basic |
|
|
Dim resultFields As Fields = rcd.DataDefinition.ResultFields |
|
|
C# |
|
|
Fields resultFields = rcd.DataDefinition.ResultFields; |
|
|
Visual Basic |
|
|
Dim rowController As RowsetController = rcd.RowsetController |
|
|
C# |
|
|
RowsetController rowController = rcd.RowsetController; |
|
|
Visual Basic |
|
|
Dim rowCursor As RowsetCursor = rowController.CreateCursor(Nothing, rowsetMD, 0) |
|
|
C# |
|
|
RowsetCursor rowCursor = rowController.CreateCursor(null, rowsetMD, 0); |
|
Retrieve an instance of the Rowset object using the Rowset property of the RowsetController object.
|
Visual Basic |
|
|
Dim modifiedRowset As Rowset = rowCursor.Rowset |
|
|
C# |
|
|
Rowset modifiedRowset = rowCursor.Rowset; |
|
In this example all batches except the first batch are deleted.
|
Visual Basic |
|
|
Dim rbatch As New RecordBatch() |
|
|
C# |
|
|
RecordBatch rbatch = new RecordBatch(); |
|
|
Visual Basic |
|
|
Dim mysets As New Rowsets() |
|
|
C# |
|
|
Rowsets mysets = new Rowsets(); |
|
|
Visual Basic |
|
|
Dim dataSet As DataSet = New DataSetClass() |
|
|
C# |
|
|
DataSet dataSet = new DataSetClass(); |
|
|
Visual Basic |
|
|
Dim dbController As DatabaseController = rcd.DatabaseController |
|
|
C# |
|
|
DatabaseController dbController = rcd.DatabaseController; |
|
|
Visual Basic |
|
|
dbController.SetDataSource(dataSet, "", "") |
|
|
C# |
|
|
dbController.SetDataSource(dataSet, "", ""); |
|
This sample retrieves a Rowset from the report, removes all batches except for the first batch, adds the modified Rowset object to a Dataset object, and then changes the report data source at runtime.
|
Visual Basic |
|
|
Private Sub ModifyRuntimeDatasource(ByVal rcd As ISCDReportClientDocument) |
|
|
C# |
|
|
private void ModifyRuntimeDatasource(ISCDReportClientDocument rcd) |
|
This list includes the namespaces used by the sample code:
© 2021 SAP AG. All rights reserved.
http://www.sap.com/sapbusinessobjects/
Support services
http://service.sap.com/bosap-support/
Created with the Personal Edition of HelpNDoc: Easily create EBooks