• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 787
  • Last Modified:

How do I pass multiple values for a parameter to a database command

Hello,

I have a report that I prompt the user for several paramaters.  One of the parameters is the state code.  The user can select one or more or the 12 states for which they can run this report.  The parameter is then passed to the database command parameter.  The only problem is the command only works when I select 1 state code.  If I select more than one state code the query returns nothing to the report.  How do I change my SQL to accept more than one parameter.  
Also, "allow multiple values" equals TRUE.

WHERE   B.RMSBRGLVL4 IN ('CG9A','C77F')    
AND     C.RECORDTYPE = 'D'
AND     C.RMSSTATECD IN ('{?StateCode}')     <---- I need to be able to pass a list of values i.e. ('CA','CO','FL',GA')
AND     B.RMSDTCHGDT <> 0
AND     DATE(TIMESTAMP(B.RMSDTCHGDT||'000000')) BETWEEN {?StartDate} AND {?EndDate}
0
BrianMack
Asked:
BrianMack
  • 3
  • 2
1 Solution
 
mlmccCommented:
First don't use '  ' around the parameter name

          C.RMSSTATECD IN ({?StateCode})

How are you calling the report?
I believe ther eis an example in here
http://support.businessobjects.com/communityCS/FilesAndUpdates/rdc10_samples.exe.asp

mlmcc

0
 
BrianMackAuthor Commented:
Hi Michael,

I originally tried to make the In statement work without the quotes and I got the following error:  Failed to retrive data from database. Details: 42S22:[IBM][iSeries Access ODBC Driver][DB2 UDB]SQL0206 - Columns GA not in specified tables. [Database Vendor Code: -206].

I'm running the report in Crystal Reports XI report designed.  WShen I get it tweaked right I'll publish it to Buisness Object XI so the user can access it.
0
 
BrianMackAuthor Commented:
The official word from Business Objects technical support.


Question : How to pass the input of a multiple values parameter to a command object parameter ?

Solution :

When creating a report based on a command object, it is not possible to create a multiple values parameter for the command because SQL only support dicrete value parameter.

To workaround this situation, you can create a report based on a table that return one record. Then, create in Crystal Reports a multiple values parameter. After, convert the values entered in the parameter into a string, and finally pass the string value to a subreport discrete value parameter that is based on your command object.
0
 
mlmccCommented:
Question closed and points refunded

mlmcc
Crystal Reports Page Editor
0
 
BrianMackAuthor Commented:
THANKS.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now