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

Display multiple values of a field

Status
Not open for further replies.

pleashelp

Technical User
Feb 27, 2002
97
US
I have a field called OfficeName. My Parameter is Office Number and this parameter allows multiple values. When I choose the multiple Office Numbers, I want to display the Office names on the report and not the value of the parameter.

When I use: Join ({SysFile.strOfficeName},", ") I get the error message: "A string array is required here"

What am I doing wrong?

Thanks
 
Hi
convert your office number to text
totext({field_name})
because your join is string to number
so if you convert your office number to text you should be able to like

cheers

pgtek
 
You could try this formula:

NumberVar i:= 1;
NumberVar limit := UBound({?offno});
StringVar Display := "Selected Offices: ";

For i := 1 to limit do
(
Display := Display +
(if {?offno} = 1 then "Office Name 1"
else if {?orderid} = 2 then "Office Name 2") +
iif(i<limit, &quot;, &quot;,&quot; &quot;)
);
Display;

You would need to add each office id and description into the if-then part of the formula.

-LB
 
At the runtime of the report, it doesn't know the offices.

Obviously at the details section you can just place the field and there's your list.

If you want the list prior to the details section, say in the report header, consider inserting a subreport into the
Report Header and link your parameter to the subreport {SysFile.strOfficeNumber}

Now you can list them up front.

If this doesn't resolve, please post example data and expected output.

-k
 
SynapseVampire is correct in that the subreport in the header option is the only way you will be able to achieve this if you want your list to appear before the details section.

After linking the subreport to all the main report variables, you would have to group by Office Number in the subreport, and populate a shared string variable in the group footer of OfficeName + ', '.

Insure it against 254 character limits, and return the shared variable to the main report.

Naith
 
SV and Naith--

I'm confused. I guess you think that my suggestion won't work, but it works for me. I did assume that pleashelp wanted to display the selected parameters in the report header or page header. And since the runtime of the report follows the selection of the parameters, the selected office names are available in the report header. What am I missing here?

-LB
 
Maybe it's me who's missing something. If you have a table which features, say, 100 offices, and select a random 5 of their ids, how does your loop source the office names from the office ids without using a subreport, recurring section, or physically pairing the numbers and offices by hardcoding the names in the formula?

Naith
 
Naith,

Okay, yes--I was hardcoding the names in the formula, and although it works, it could be cumbersome if the number of offices are large, so, in that case, a subreport is probably the best solution. Thanks for explaining.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top