Print Page | Close Window

Build Array from Parameter with Multiple Values

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=17441
Printed Date: 07 May 2024 at 11:58am


Topic: Build Array from Parameter with Multiple Values
Posted By: vcs1161
Subject: Build Array from Parameter with Multiple Values
Date Posted: 29 Aug 2012 at 3:06am
If I have a parameter in my Crystal report that can accept multiple values, is there a way to build those choices into an array and use in my SQL code?  So if the user selects 1,2,3, and 4 from the parameter I would like to pass that as an array to use in my SQL code.  An example of my SQL code:
 
select
*
from
tablename
where
id in ({parameter name}) ** this is where the array would be based on the parameter select in Crystal.  This array would be 1,2,3,4 to be used in my SQL.
 



Replies:
Posted By: hilfy
Date Posted: 29 Aug 2012 at 3:22am
You don't have to convert it to an array - Crystal will automatically do that for you.  If you're using a command, you need to delete the parameter from the report and recreate it in the command (which will create it in the report with a few additional underlying properties that regular parameters don't have.)  You then use it in your Command like this:
 
where id in {?parameter name}
 
Note: NO parentheses around the parameter!
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: vcs1161
Date Posted: 29 Aug 2012 at 3:39am
Oh my goodness.  That was it!  Was that Allow Multiple Values checkbox something new in the XI version?  I swear I could not do this before.



Print Page | Close Window