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!

Displaying multiple value parameters in report header 1

Status
Not open for further replies.

Nilsen

MIS
Dec 31, 1999
36
0
0
US
I'm trying to display all the values that were entered into a parameter field that allows multiple values. We are using Crystal Reports version 7.0.100.12 (version 7 MR 1). From The Crystal Decisions Knowledgebase, I got the following example - indicated it is for version 7:

numbervar counter;
stringvar holder;
counter := count({?Multi});
//The above formula line retrieves the number of elements in the array.
while counter > 0 do
(holder := holder + {?Multi}[counter] + ',';
counter := counter - 1);
holder [1 to (length(holder)-1)]
//The above formula line removes the trailing ',' from the string.

But, when I enter this (modifying it to match my database), it gives me an error starting at the "while counter > 0 do" line saying: "The remaining text does not appear to be part of the formula."

Not sure what I'm missing...
 
This worked here, but I'm using CR 8.5 (note I changed the parm name):

numbervar counter;
stringvar holder;
counter := count({?stringtest});
in the array.
while counter > 0 do
(holder := holder + {?stringtest}[counter] + ',';
counter := counter - 1);
holder [1 to (length(holder)-1)]

It looks like it reverses the choices though.

-k
 
Yes, it looks like it should work on my version too, Crystal Decisions knowledgebase even states this if for version 7.0 and higher (and even recommend a different one for version 8). But, it appears my version is getting hung up on the "while" and "do" statements. I'm wondering if there is an advanced formula *.dll that did not get loaded? Or one that should be loaded that Crystal did not put on their knowledgebase (I've seen that before)...

NE
 
Looping constructs were not introduced until v8.
So if you're stuck using v7 you can't use FOR,DO,WHILE etc.


Bob Suruncle
 
Nilsen,
This is what I use for my Crystal version 7.3 reports. Works just fine, and you shouldn't have any problem.

WHILEPRINTINGRECORDS ;
STRINGVAR ARRAY Input := {?COMPLEX };
NUMBERVAR howmany := COUNT (Input);

Input [1] +
IF howmany > 1 THEN ', ' + Input [2] +
IF howmany > 2 THEN ', ' + Input [3] +
IF howmany > 3 THEN ', ' + Input [4] +
IF howmany > 4 THEN ', ' + Input [5] +
IF howmany > 5 THEN ', ' + Input [6] +
IF howmany > 6 THEN ', ' + Input [7] +
IF howmany > 7 THEN ', ' + Input [8] +
IF howmany > 8 THEN ', ' + Input [9]
 
The following article shows how to print multiple and range parameters for different versions of CR and for different data type parameters:


The formula posted by mulema probably originated from this article. If you use this formula in v7 you have to hard code enough lines to account for the number of entries the user will enter.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
I just pasted the formula from this article into a V7 report and it complains about the WHILE, so I believe that the article is wrong.

I still have the report I created to test all of the new features in v8, and that is where all of the looping logic was introduced. Unless there was a late version of v7 that snuck these in, I don't think you can do any looping in v7.

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
I'm farily sure the additional control structures:
While, Do, For, Case

All appeared in CR8. So in CR7 you will have hard code the solution. The method I used in Cr7 is.
STRINGVAR s := "";

if count({?Complex})>=1 then s:= {?Complex}[1];
if count({?Complex})>=2 then s:=s + "," + {?complex} [2];
if count({?Complex})>=3 then s:=s + "," + {?complex} [3];
if count({?Complex})>=4 then s:=s + "," + {?complex} [4];
if count({?Complex})>=5 then s:=s + "," + {?complex} [5];
//repeat as many times as required
//make sure s isn't longer than 254 chars
s

Editor and Publisher of Crystal Clear
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top