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

Printing a Parameter Array

Status
Not open for further replies.

caymanuser

IS-IT--Management
Sep 26, 2002
14
CA
I have read review every forum question but cannot find the answer.
Part of my selection of data is a parameter field {?account}this is numeric and can have multiples values generally upto 5 or 6 occurances i.e. 1001, 1002, 1340, 2005 or 9999 for all accounts. Selecting the required data works fine.

I need to print the parameter array in the report heading regardless of the number of elements. I've set up a formula with
Join(totext({?Accounts}),",") but this generates an error.

Any suggestions
 
Hi

This comes straight from George Peck's book on ver 8.0
It works really well for me. Create this formula and drop it in the report or page header. You will need to modify the parameter fields to suit your needs.

// Shows the regions chosen in the multi-value ?Region parameter field

// Uses a For loop to cycle through all the elements of the parameter field
// and accumulate them in a variable.

NumberVar Counter;
StringVar Message := "Regions Chosen: ";

// cycle through all members of the multi-value ?Region parameter field
For Counter := 1 to Count({?Region}) Step 1 Do
(
// accumulate the values in the Message variable, along with comma/space
Message := Message & {?Region}[Counter] + ", "
);

// strip off last comma/space added by the loop
Left(Message, Length(Message) - 2)

Good Luck
Lwiguy
 
Many Thanks,

That worked fine, had to add a "ToText"

Best Regards
 
join() works great if you are in version 8 or newer of crystal and if the array is a string array. If it is not a string array then you must use a solution like lwiguy's, or something very close to it. Software Sales, Training and Support for Macola, Crystal Reports and Goldmine
dgilsdorf@mchsi.com
 
For older versions of CR I have some examples in faq149-243, formula # 7. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top