Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
|
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 3rd, 2008, 02:58 AM
Registered User
 
Join Date: Aug 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to pass multiple values in one parameter

Hi..
how to pass multiple selected values in one parameter.
My requirement is that I will have 3 Paramters i.e., on my webform user will select
*. startdate and enddate
*. Division
*. Department

If user had selected one division (ex: Fin) and one department(ex: Finance) then i would not have any problem.

But here user can select multiple division (ex: Fin,IT,HR) and multiple departments (ex: Finance,Information.Tech,Human Resources) then how to pass this multiple paramters in asp.net?

I have sample code which i used in previous project for passing single parameters..below is code,
Below am passing Date (Period), ProjectNo and SupplierCode (Here user can select only one Project No and SupplierCode).
Try
            If ConState = False Then
                Connect()
            End If
            Dim ConnInfo As New ConnectionInfo
            With ConnInfo
                .ServerName = mOleDB.strServerName
                .DatabaseName = mOleDB.strDBName
                .UserID = mOleDB.strUsrName
                .Password = mOleDB.strUsrPwd
            End With
            ' Declare variables needed to pass the parameters
            ' to the viewer control.
            Dim paramFields As New ParameterFields
            Dim paramField As New ParameterField
            Dim discreteVal As New ParameterDiscreteValue
            Dim rangeVal As New ParameterRangeValue

            ' Set the name of the parameter field, this must match a
            ' parameter in the report. (Date Parameter)
            paramField.ParameterFieldName = "Period"

            ' Set the start and end values of the range and pass it to the 'parameter.
            rangeVal.StartValue = frmNCNClosedReport.StartDate
            rangeVal.EndValue = frmNCNClosedReport.EndDate
            paramField.CurrentValues.Add(rangeVal)

            ' Add the first parameter to the parameter fields collection.
            paramFields.Add(paramField)

            ' The second parameter is a discrete value. The paramField variable
            ' is set to new so the previous settings will not be overwritten.
            paramField = New ParameterField

            'Set the name of the parameter field, this must match a
            ' parameter in the report.
            paramField.ParameterFieldName = "ProjectNo"

            ' Set the first discrete value and pass it to the parameter based on conditions.
            If frmNCNClosedReport.ProjectNo <> "" Then
                discreteVal.Value = frmNCNClosedReport.ProjectNo
            Else
                discreteVal.Value = "*"
            End If
            paramField.CurrentValues.Add(discreteVal)

            ' Add the parameter to the parameter fields collection.
            paramFields.Add(paramField)

            ' Set the second discrete value and pass it to the parameter.
            ' The discreteVal variable is set to new so the previous settings
            ' will not be overwritten.
            paramField = New ParameterField

            'Set the name of the parameter field, this must match a
            ' parameter in the report.
            paramField.ParameterFieldName = "SupplierCode"

            discreteVal = New ParameterDiscreteValue
            ' Set the second discrete value and pass it to the parameter based on conditions.
            If frmNCNClosedReport.SupplierCode <> "" Then
                discreteVal.Value = frmNCNClosedReport.SupplierCode
            Else
                discreteVal.Value = "*"
            End If
            paramField.CurrentValues.Add(discreteVal)

            ' Add the parameter to the parameter fields collection.
            paramFields.Add(paramField)

            ' Set the parameter fields collection into the viewer control.
            CQC_CrystalReportViewer_SuppProjOpen.ParameterFiel dInfo = paramFields
            CQC_CrystalReportViewer_SuppProjOpen.ReportSource = crReportDocument

            For Each cnInfo As TableLogOnInfo In Me.CQC_CrystalReportViewer_SuppProjOpen.LogOnInfo
                cnInfo.ConnectionInfo = ConnInfo
            Next
            'Me.CrystalReportViewer_SuppProjClosed.RefreshRepo rt()
            CQC_CrystalReportViewer_SuppProjOpen.Visible = True
        Catch err As System.Exception
            MessageBox.Show(err.Message, "System error!", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try

Thanks to help.






Similar Threads
Thread Thread Starter Forum Replies Last Post
pass multiple values to 1 parameter in Crystal 10 ckwizard77 Crystal Reports 0 July 26th, 2007 01:54 PM
How to pass multiple values from Crystal Report to vanitha Crystal Reports 2 June 5th, 2007 07:48 AM
Pass multiple values to XSL? myhtpc XSLT 5 March 17th, 2006 11:16 AM
Passing multiple values to a pass- through query donnie200 Access VBA 2 July 7th, 2005 04:00 PM
how to pass multiple values throw url class object kfarooq Servlets 1 June 20th, 2003 04:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.