To navigate through records stored in a rowset

Parent Previous Next

 

Report Application Server .NET SDK Developer Guide

To navigate through records stored in a rowset


 







The Rowset object is a structure that stores rows of filtered records in a flat, unnormalized format. ARowset object can store any kind of data from any database that your report can access. This example shows you how to navigate through the records stored in a rowset.

  1. Use the RowsetCursor object to get the current record.
  2. Iterate through the records using the MoveNext method.

NoteNote

Use the isEOF method to check that you do not go out of bounds. If the TotalRecordKnown property is set to false, the getRecordCount method will not return accurate data.

This sample iterates through all records in a Rowset object and saves the values in a String object.

Visual Basic

Private Function NavigateRowset(ByVal rcd As ISCDReportClientDocument, ByVal rowCursor As RowsetCursor) As String
 Dim rows As String = ""
 Do
  Dim currentRecord As Record = rowCursor.CurrentRecord
  rows += "<tr>"
  For i As Integer = 0 To currentRecord.Count - 1
   rows += "<td>" & currentRecord(i) & "</td>"
  Next
  rows += "</tr>"
  rowCursor.MoveNext()
 Loop While Not rowCursor.IsEOF
 Return rows
End Function

C#

private string NavigateRowset(ISCDReportClientDocument rcd, RowsetCursor rowCursor)
{
 String rows = "";
 do
 {
  Record currentRecord = rowCursor.CurrentRecord;
  rows += "<tr>";
  for (int i = 0; i < currentRecord.Count; i++)
  {
   rows += "<td>" + currentRecord[i] + "</td>";
  }
  rows += "</tr>";
  rowCursor.MoveNext();
 } while (!rowCursor.IsEOF);
 return rows;
}

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 iPhone documentation