Symptom
I would like to view the text of a formula field on a crystal report using the RAS .NET SDK.
Can this be accessed by name?
Resolution
The following code shows how to access a formula fields text by name using RAS .NET:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.ReportAppServer.ClientDoc
Imports CrystalDecisions.ReportAppServer.DataDefModel
Imports CrystalDecisions.ReportAppServer.Controllers
Partial Class _Default
Inherits System.Web.UI.Page
Dim crRpt As New ReportDocument
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Load the report
crRpt.Load("C:\Documents and Settings\Administrator\Desktop\vbnet_Get_Formula_Field_Text\MyReport.rpt")
Dim rcd As ISCDReportClientDocument
'Get the report as a ReportClientDocument
rcd = crRpt.ReportClientDocument
'Create a formula field object
Dim myFormField As FormulaField
'Search for the formula field we want
myFormField = rcd.DataDefController.DataDefinition.FormulaFields.FindField("MyFormulaField", CrFieldDisplayNameTypeEnum.crFieldDisplayNameName)
'Output the formula text
Response.Write(myFormField.Text)
End Sub
End Class
Keywords
net .net ras formula field fields text check view output crystal report , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem
Product
Crystal Reports 2008 V1 ; Crystal Reports Server XI R2 ; SAP Crystal Reports XI R2
SAP Knowledge Base Article - Public