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!

Parameter delimma 1

Status
Not open for further replies.

mangledbabyducks

Technical User
Mar 24, 2004
14
0
0
US
I am using Crystal Reports 8.5 with an Interbase database thru an ODBC connection.

Now with that out of the way, here is my problem. I have a parameter where the client can type out a list
(ie. 1,3,10) and only these items will appear on the report.

The number corresponds to a table with the following info:
1 - Widgets
2 - Gizmos
3 - Thingeez
4 - Whoseamawhatcheez
.....
10 - Other


I need to print the names of the items in a list in the report header.

ie. Items Ordered: (Widgets, Thingeez, Other)

Would there be an array or a subreport involved? Or both?

I'm stumped.

Thanks,
MBD
 
If you only have ten, you could hard code the description in a formula like the following:

whileprintingrecords;
numbervar array := {?parm};
numbervar counter;
numbervar i := ubound(parm);
stringvar display;

for counter := 1 to i do(
display := display + (
if {?parm}[counter] = 1 then "Widgets" else
if {?parm}[counter] = 2 then "Gizmos" else//etc.
"Other"
) + ", ");
left(display, len(display)-2)

Otherwise, you could insert a subreport linked on the parm that uses the description table and use the parm to limit the records in the subreport. Then you could concatenate the description field by using a formula like the following in the detail section:

whileprintingrecords;
stringvar x := x + {table.itemdesc}+ ", ";

Then in the subreport footer use the formula:
whileprintingrecords;
stringvar x;
left(x,len(x)-2)

Suppress all subreport sections except the report footer.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top