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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to list all elements of array parameter

Status
Not open for further replies.

Hypermommy

Programmer
May 23, 2003
75
0
0
US
Hi all,

I'm using Crystal Reports 9. I have a parameter {?Type} into which users can select multiple values. I *think* Crystal views this as an array once they select their types (right?). I would like to list all types selected at the bottom of the report. I'm guessing I need to include a formula that would do the following:

strTypeListing
for each element in array
strTypeListing = strTypeListing + thisElement + chr(13)
next

But I don't know how to cycle through the array and I don't know if chr(13) is going to be valid to put a carriagereturn/linefeed in the string.

How can I do this? Thanks.

Oh, and one more question.... if the {?Type} parameter is an array, does it get passed to a SQL Server stored procedure as such? Then the SP could break it out and use the elements in it?

Thanks.


-= Hypermommy =-
 
You can use the following formula:

join({?yourstringparm},chr(13))

Right click on this formula and format it to "Can Grow." This can be placed in the report header or footer, as you wish.

I can't help you with your second question.

-LB
 
If you're using a stored procedure as a data source, you might notice that you can't set the parameters to allow multiple values. SQL Server can't take an array as a parameter (yet!). If you want to send multiple values to a procedure, you'd either have to have multiple parameters defined, or send a delimited list that would have to be parsed out within the procedure.

-dave

 
You also can't use Crystal parameters to pass values to the Stored Procedure. Instead, you'll have to define the parameter within the stored procedure itself. When you verify the stored procedure, it will populate the parameter in Crystal.


~Kurt
 
I used the above formula:

join({?yourstringparm},chr(13))

to place the values of the parameter in the header of my report. I entered two values: 270004 and 251682. It returned the following in the header:

270004
251682

Is there any way to format this? I'd like the following to be returned:

270004, 251682
 
nevermind, I figured it out:

join({?txtMemberID}, ", ")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top