SAP Knowledge Base Article - Public

1217416 - How to display the field values in a report's database table using RAS in .NET

Symptom

A Microsoft Visual Studio .NET web application uses the Report Application Server (RAS) 10 .NET SDK as the reporting development tool.

 

How can you programmatically display the values for each field in the report's database table(s)?

Resolution

To programmatically display the values for each field, use the 'RowsetController' object and the 'BrowseFieldValues' method from the RAS SDK. To use these, add the following references to your .NET application:

" CrystalDecisions.ReportAppServer.ClientDoc

" CrystalDecisions.ReportAppServer.Controllers

" CrystalDecisions.ReportAppServer.DataDefModel

Once the references have been added to your application, use the following VB .NET code to display the field values:

====================

Dim Table As

CrystalDecisions.ReportAppServer.DataDefModel.Table

Dim Field As

CrystalDecisions.ReportAppServer.DataDefModel.Field

Dim FieldVals As

CrystalDecisions.ReportAppServer.DataDefModel.Values

Dim FieldVal As

CrystalDecisions.ReportAppServer.DataDefModel.Value

Response.Write("Browsing all database fields in the

report <BR>")

For Each Table In

rptClientDoc.DatabaseController.Database.Tables

Response.Write("<BR><big><B>Table:" & Table.Alias &

"</B></big><BR>")

For Each Field In Table.DataFields

Response.Write("<BR><BR><B>" & "Field: " & Field.Name

& ":</B><BR>")

If rptClientDoc.RowsetController.CanBrowseField(Field)

Then

FieldVals =

rptClientDoc.RowsetController.BrowseFieldValues(Field)

For Each FieldVal In FieldVals

If Not (FieldVal.Value Is Nothing) Then

Response.Write(CStr(FieldVal.Value) & ", ")

End If

Next

End If

Next

Next

====================

====================

NOTE:

By default, the RAS service will only browse the first 100 records in the database. This number can be adjusted in the Crystal Configuration Manager.

====================

Keywords

DOTNET DOT NET BROWSING RECORDSET RECORD SET ROWSET CONTROLLER VISUAL BASIC Crystal Enterprise Report Application Server Rowset Controller Field Browsing , c2015594 , KBA , BI-DEV , Business Intelligence Software Development Kits (SDKs) , How To

Product

Crystal Reports 2008 V1 ; Crystal Reports Server 2008 V1, OEM edition ; Crystal Reports Server XI R2, OEM edition ; Crystal Reports Server, OEM edition XI ; SAP Crystal Reports Server, OEM edition 10.0 ; SAP Crystal Reports XI ; SAP Crystal Reports XI R2