1487800 - How to retrieve all database fields in a report - using RAS SDK for VS .NET

SAP Knowledge Base Article - Public

1487800 - How to retrieve all database fields in a report - using RAS SDK for VS .NET

Symptom

Resolution

  • Fields used in a report are stored in the ResultFields collection
  • Use the code below to retrieve these fields
  • Note that this code will not retrieve database fields used in a formula field or in a selection formula
Private Function retrieveDbFieldsInReport(reportClientDocument As ReportClientDocument) As Fields
 Dim fieldsInReport As New Fields()
 Dim resFields As Fields = Nothing
 Try
  resFields = reportClientDocument.getDataDefinition().getResultFields()
 Catch e As ReportSDKException
  Return Nothing
 End Try
 For i As Integer = 0 To resFields.size() - 2
  If resFields.getField(i).getKind() = FieldKind.DBField Then
   ' Add database field to our collection
   fieldsInReport.addElement(resFields.getField(i))
  End If
 Next
 Return fieldsInReport
End Function

Keywords

KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , How To

Product

Crystal Reports 2008 V1 ; SAP Crystal Reports XI R2