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!

How do I output array values

Status
Not open for further replies.

wires

Technical User
Oct 14, 2002
548
US
I have a nice little array of strings called MissingNumbers. I need to print all of the elements of this array in the report footer. I have tried a formula field like this:

//
WhilePrintingRecords;
numberVar i;
stringVar Array MissingNumbers;
numberVar ArrayCnt;

for i = 1 to ArrayCnt do
(MissingNumber)
//

When placed in the report footer the formula field says "True". Obviously what I want is a list of numbers that are in the array MissingNumber. If I put this in the formula field:

//
WhilePrintingRecords;
stringVar Array MissingNumbers;

MissingNumber[3]
//

I get the number (actually a string value in the underlying DB) "22038" which is in element 3 of MissingNumber.

What am I doing wrong?

 
Try:

WhilePrintingRecords;
stringVar Array MissingNumbers;
Join(MissingNumbers,chr(13))

This will separate them with a carriage return, or substitute whatever you need for the second argument.

Make sure you turn on the Can Grow option.

-k kai@informeddatadecisions.com
 
Thanks! I just found the join() function searching the Crystal Decisions forums.

The problem is that join() tops out at 255 characters which in my application is around 40 numbers. I stuck an error handler in but I would really like to see all the array elements.
 
You'll probably have to iterate through the array and populate numerous smaller arrays (or string variables) which are limited to 254 chars or less.

This is a common problem in CR 8.5 or below, since you didn't share your version, I hoped for the best.

On the general subject of missing numbers, I try to construct them so that they contain entries like:

1 - 23
26 - 45
47
49
51 - 72

rather than a single value for each. This improves readability, and conserves space.

-k kai@informeddatadecisions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top