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!

Array displayed as string

Status
Not open for further replies.

Rob32

Technical User
Oct 14, 2002
18
NZ
I want to report the results of an array as a string in the group footer, in the format "ArrayItem1, ArrayItem2, ArrayItem3 etc"

The formula (called @Array)I am using to output the array is the following:

Code:
whileprintingrecords;
stringVar array MyArray;
numberVar Counter;

if onfirstrecord or {Owner_details.Owner ID} <> 
previous({Owner_details.Owner ID}) then 
(redim MyArray[1];
Counter := 0);

if not ({Imported_Animals.SPECIES} in MyArray) then
(Counter := Counter + 1;
if counter <=1000
then (Redim Preserve MyArray[Counter];
MyArray[Counter] := {Imported_Animals.SPECIES}));

which I put into the (suppressed) details section. I then try to output the array results as a string, using 2 formulae:

Formulae 1 (placed in the suppressed details section:
Code:
StringVar list;

If list=&quot;&quot; then
list := {@Array}
else If Length(list) <= 1000 then
list := list  + &quot;, &quot; + {@Array}

This is then displayed by Formulae 2 in the group footer section:
Code:
WhilePrintingRecords  ;
stringVar  list;
stringVar  lastList;

lastList := list;
list := &quot;&quot;;
lastList


The kind of output I am getting is:

ArrayItem1,,,,,,ArrayItem2,,,,,

or ArrayItem1,,,,,

Any help?

Thanks, Rob
 
The building of the array looks fine, the output does not, this should simplify the display:

whileprintingrecords;
stringVar array MyArray;
join(MyArray,&quot;, &quot;)

Output of any formula string is limited to 254 chars in CR 8.5 or below, so you may hit the wall there.

-k
 
Fantastic! Worked like a treat...

Cheers, Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top