Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comma Seperated List parameter

Status
Not open for further replies.

mdecap

Programmer
Jul 20, 2007
7
US
I have a Crystal 9 Report set up that is to filter a dataset by a date range and by multiple ID's sent in by a VB.Net Application.

The Formula is setup as such:

{REPORT.DATE}>={?BDATE} and
{REPORT.DATE}<={?EDATE} and
{REPORT.ID} in [{?ID}]

I have experimented with various ways of sending in the ID value, and after "hardcoding" test data into the Formula Editor I saw the format should be like:

"00001", "00002"

So I setup the VB.Net app to send in a string in the same format but it is not yielding any results (I have a feeling it is sending in ""00001, "00002"").

Is there some small syntactical issue I am missing, or should (could?) this be accomplished another way? Thanks!
 
Hi,
You need to use some 'Replace' type functions in your code to preprocess the string of values
( By the way CR XI does not require the quotes or the []s
if no spaces are in the value items, you can just use:
{REPORT.ID} = {?ID}, as long as {?ID} is defined as a multiple-value parameter.
So you could pass
Smith,Jones,Thomas

and CR would see it as
{REPORT.ID} = Smith,Jones,Thomas

and send it to the database as
( this is Oracle)
WHERE ("REPORT.ID"='Smith' OR "REPORT.ID"='Jones' OR "REPORT.ID"='Thomas')

Might be a reason to upgrade....Or try it with 9






[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Hi Turkbear,

I reformatted the string that is being sent in the ID parameter as a single value of:

00001,00002

I then changed the parameter to Allow Multiple Values. However, when running the report it gave an error stating that...

"This array must be subscripted. For example Array."

I'm not too familiar with Crystal, so I'm trying to process this problem just the same as a SQL Query. Any ideas what I'm missing here?
 
Ok, I think I got it here.

I took off the "Allow Multiple Values" option for the parameter.

In the formula editor I then added Split({?ID},",") and it seems to run quite nicely.

Thanks for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top