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!

location name list from parameter

Status
Not open for further replies.

mdahlen

Technical User
Feb 26, 2003
6
US
My reports have a parameter for location that is based on the location ID (Number).
I would like to display the location names (string)in the report header.
So, if user picks loc_ID 14 and 13 then the report header will list Location Names "Main Hospital, West Hospital".

Is there an 'easy' way to do this?

Thanks!
 
You seem to be entering two values for one parameter. Please clarify.

To display location, it might be easiest to have a subreport in the report header. This would only be performed once, and so would not slow the report very much. You would pass it the parameter value and it could return the values.

To put them all on one line would need a string variable that accumulated the values. This could be all within the subreport, shown on the subreport's report footer (the entire subreport being in the main report header)

You should give your Crystal version.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Yes--it is an "Allow muliple values" parameter.
User can enter 1 or up to 10 values.
Using CR 10 --soon switching to CR XI.

So, subreport best way to go?
Create a stringvar "names" and put that in the details of the subreport?
Put subreport in Header?

 
That's what I'm suggesting, a subreport in the main report header. I've never used multi-value parameters, so I've no idea whether they can be passed to a subreport. The normal method is Edit > Subreport Links.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
If you have a table that uses both the ID and the corresponding location name, you can insert a subreport where you use that table and place the location name on the detail line. Insert a parameter in the subreport for {?location} and then link the subreport to the main report by linking on the parameters in each. Be sure to use the dropdown when selecting the subreport parameter {?location}, not the default {?pm-?location}.

Since you only have 10 locations, the other alternative would be to create a formula like the following:

numbervar i;
stringvar parmdesc;

for i := 1 to ubound({?location}) do(
parmdesc := parmdesc + (
select {?location}
case 1 : "Boston"
case 2 : "New York"
case 3 : "Los Angeles"
|
|
v
case 10 : "Atlanta"
) + ", ");
left(parmdesc, len(parmdesc)-2);

Substitute your id numbers for the 1 to 10 after "case".

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top