[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Crystal Reports Multivalue Parameter

Posted on 2004-11-24
2
Medium Priority
?
413 Views
Last Modified: 2012-08-13
I have a crystal report with a parameter that takes multiple values. I'm using the following code for some regular parameter fileds:

   Dim Report As New CrystalDecisions.CrystalReports.Engine.ReportDocument
   Report.Load(ReportPath)
   Report.SetParameterValue(x, "20")

How do I send multiple values?
0
Comment
Question by:m9s999
2 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 1000 total points
ID: 12669101
I use this code to pass values to parameters:

    Private Sub SetParameters()
        Dim objParameterFieldDefinition As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition
        Dim objParameterValues As CrystalDecisions.Shared.ParameterValues
        Dim objParameterDiscreteValue As CrystalDecisions.Shared.ParameterDiscreteValue

        'Set the parameter name on the next line
        objParameterFieldDefinition = rptReport.DataDefinition.ParameterFields.Item("pMgmtFees")
        objParameterValues = New CrystalDecisions.Shared.ParameterValues
        objParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
        'Set the parameter value on the next line
        objParameterDiscreteValue.Value = Me.mdecMgmtFees
        objParameterValues.Add(objParameterDiscreteValue)
        objParameterFieldDefinition.ApplyCurrentValues(objParameterValues)

        'Set the parameter name on the next line
        objParameterFieldDefinition = rptReport.DataDefinition.ParameterFields.Item("pIncentiveFees")
        objParameterValues = New CrystalDecisions.Shared.ParameterValues
        objParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
        'Set the parameter value on the next line
        objParameterDiscreteValue.Value = Me.mdecIncentiveFees
        objParameterValues.Add(objParameterDiscreteValue)
        objParameterFieldDefinition.ApplyCurrentValues(objParameterValues)

     End Sub
0
 

Author Comment

by:m9s999
ID: 12670471
Thanks. I modified it as follows to fit what I needed:

Dim Params As New CrystalDecisions.Shared.ParameterValues
Dim Value As CrystalDecisions.Shared.ParameterDiscreteValue

Value = New CrystalDecisions.Shared.ParameterDiscreteValue
Value.Value = CInt(10)
Params.Add(Value)

Value = New CrystalDecisions.Shared.ParameterDiscreteValue
Value.Value = CInt(20)
Params.Add(Value)

Report.SetParameterValue(1, Params)

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Suggested Courses

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question