SAP Knowledge Base Article - Public

1537998 - How to get the count of parameters in Crystal report using Crystal Reports .NET SDK.

Symptom

  • How to get the count of parameters in Crystal report using Crystal Reports.NET SDK.

Environment

  • Crystal Reports 2008 SP1 and above
  • Visual Studio 2008  

Resolution

  • Here is the VB.NET code to get the count of parameters.
Imports System.Collections
Imports System.Web.UI.WebControls
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles form1.Load
        Dim rd As New ReportDocument
        rd.Load(Server.MapPath("Report.rpt"))
For i As Integer = 0 To rd.ParameterFields.Count - 1
         If rd.ParameterFields(i).Name.Contains("Pm-") = False Then
               TextBox1.Text = rd.ParameterFields.Count
        End If
        Next
    End Sub
End Class

Keywords

ParameterFields, Crystal Report 2008, Visual studio 2008, ParameterFields.Count , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To

Product

Crystal Reports 2008 V1