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

Multiple values in a numeric parameter 2

Status
Not open for further replies.

pleashelp

Technical User
Feb 27, 2002
97
US
Using CR 8.5. Have a parameter {?Event} which is set up as a number with multiple values allowed. I can choose the multiple values and they display on the report just fine. Now I want to put a text field in the Page Header that will show something like: "Event(s): 18, 20, 20341". How do I do this? I have tried to use a formula with a join that looks like this: "Filtered Event(s): " + join({?Event},", ")
But I get an error message: "A string array is required here", with the cursor placed right before the curly brace of the parameter. What am I doing wrong?

Ckesen
 
that is because the parameter is numeric

try this:

"Filtered Event(s): " + join(totext({?Event},0,"",""),", ")

that should do the trick

Jim
 
Thanks. But now I get the error message: "This array must be subscripted." :-(
 
ok...if possible can the parameter be a string type???

if so then go back to your first formula

"Filtered Event(s): " + join({?Event},", ")

I guess Join doesn't like stuff in the middle :)

Jim
 
Just create a text object that says "Filtered Event(s): " and the create a separate fomula with your join statement in in. Then put them right next to each other in the page header. Software Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
Join only works with string arrays - if your array is a number or date you will need a formula and a ToText...

stringvar s:="";
numbervar i;

for i:=1 to count({?event}) do (
s:=s + ", " + totext({?event} ,0));
mid(s,3) // to remove the first comma and space

We published a similar solution with multivalue ranges a few months ago in Crystal Clear. Check it out. Editor and Publisher of Crystal Clear
 
Thanks for the help. I figured that I had to leave the parameter as a number, since when I changed it to a string field, no data was returned. So I tried the formula from Chelseatech. This is exactly what I entered as my formula:

stringvar s:="";
numbervar i;
for i:=1 to count({?Event}) do (
s:=s+ ", " + totext({?Event},0));
mid(s,3)

But this gave me an error message that says: "This array must be subscripted." I am at a loss!
 
Hello,
Here is another solution to this issue, though you are limited to 254 chars in the formula

If Count({?Parameter}) = 1 then
ToText({?Parameter}[1])
Else If Count({?Parmaeter}) = 2 Then
ToText({?Parameter}[1]) + " " + ToText({?Parameter}[2])
Else If Count({?Parameter}) = 3 Then
ToText({?Parameter}[1]) + " " + ToText({?Parameter}[2]) + " " + ToText({?Parameter}[3])

Hope this helps,
-Bruce Seagate Certified RCAD Specialist.
-Bruce Thuel-Chassaigne
roadkill150@hotmail.com
 
THANK YOU!! THANK YOU !! [2thumbsup]
That last answer works!

 
My apologies for the error in my posting.

The line should read...
s:=s+ ", " + totext({?Event} ,0));

I missed out the array subscript...

(I've got to stop replying to messages late at night when the fingers are falling alseep) Editor and Publisher of Crystal Clear
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top