Passing Multiple Values or a Range to a Crystal Report

Clif
Clif used Ask the Experts™
on
I'm usinf VB.Net 2010 (pro), the report was created with CR XI and the CrystalDecisions version is 13.x

I'm creating a report "broadcaster" application.  Basically the app will take in a list of reports, the email addresses of those who are subscribed, values for parameters and days/times of sending.

Everything is fine except the parameters.  A couple of the reports have, potentially, a list of values (like department names).  In the report itself, this is a listbox showing all possibilities, and another listbox that allows you to add one or more items from the first listbox.  Hopefully you know what I'm talking about.

How do I do this in code, though?

For example, if I want to show records for department ABC, I know I can do this:
myReportDocument.SetParameterValue("DeptName", "ABC")

Open in new window

But what happens if I want to show records for department ABC, DEF and GHI?

Would I do this:
myReportDocument.SetParameterValue("DeptName", "ABC")
myReportDocument.SetParameterValue("DeptName", "DEF")
myReportDocument.SetParameterValue("DeptName", "GHI")

Open in new window

Or this:
myReportDocument.SetParameterValue("DeptName", "ABC,DEF,GHI")

Open in new window

Or something completely different?

TIA
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013

Commented:
Is the parameter setup for multiple values?
If so you just add them 1 at a time.

I believe you use the AddParameterValue method.

mlmcc
Most Valuable Expert 2012
Top Expert 2014
Commented:

Author

Commented:
CodeCruiser:
What it means is that you have to pass in a ParameterValues collection as the second parameter of SetParameterValue.
This is what I thought, but the description in the Help file suggests that you can only pass strings or integers.

Tested and works perfectly.  Thanks.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial