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

pass a comma delimited list to a Crystal Report

Status
Not open for further replies.

peterswan

Programmer
Sep 25, 2002
263
US
Hello,

I've got a web form that accepts user input. One of the options for the user is "All Salespeople", which amounts to all salespeople in that person's sales division. I've already found a way to gather the salespeople from the person's sales division into a comma delimited list, and place it on the form. My question will be how to get Crystal to display only the information for those salespeople. I'm sure I can do this with a stored procedure, but that would require writing a lot of extra code.

What I'm trying to do is something like this in the select expert:

{FIN_AccountManagerMatrix.account_manager_sales_person_id_int} in ({?AcctMgrID})

where {?AcctMgrID} is a comma delimited list. Is this possible?

Thanks,

Peter [smile]



 
Can you create a parameter field of value type string? I'm not sure the maximum length of the string type, but I've done a similar thing and it worked like a charm.
 
One option is to pass it in as a single-value String. Then use Split in Crystal to convert to an array. Then use that array in your record selection formula within the report.

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Hi Ido,

Thanks for your help. I'm having trouble converting the array from a string to a number, since the ID the report is based on is a number.

Here's the code I have so far, but it draws an error saying the array must be subscripted.

stringvar array AcctMgrList;
AcctMgrList := split({?AcctMgrID}, ",");
numbervar array AcctMgrList2 := tonumber(AcctMgrList);
{FIN_AccountManagerMatrix.account_manager_sales_person_id_int} in AcctMgrList

Thanks,

Peter [smile]
 
A simpler approach is:
Code:
stringvar array AcctMgrList;
AcctMgrList := split({?AcctMgrID}, ",");
ToText({FIN_AccountManagerMatrix.account_manager_sales_person_id_int},0,"") in AcctMgrList;
Cheers,
- Ido




CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
That worked great.

Thanks for everyone's help.

Peter [smile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top