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