Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Best Way to Print Out Array Values? Post Reply Post New Topic
Author Message
Luis2101
Newbie
Newbie


Joined: 14 May 2008
Online Status: Offline
Posts: 18
Quote Luis2101 Replybullet Topic: Best Way to Print Out Array Values?
    Posted: 03 Nov 2008 at 8:55am
Hello all,

My situation is the following:
I have several global array variables that each hold 26 values. These are things like calculated dates, and different totals for several categories. I have no problem calculating all my totals and values for the report and storing them in the arrays, however, I'm not sure what the best way of printing out these totals is.

The issue is that all the values that I have in my arrays are calculated, and thus, must be printed in the footer section of my report.

My issue is that I have around 6 arrays with 26 values that need to be printed out. All of them matching to each other. In other words my Array1[1] is printed in the same row as my Array2[1] value.

Other than creating a formula to simply display each of the array values (which would result in over 100 formulas being created), what can I do to print out this report information?


IP IP Logged
Luis2101
Newbie
Newbie


Joined: 14 May 2008
Online Status: Offline
Posts: 18
Quote Luis2101 Replybullet Posted: 03 Nov 2008 at 9:24am
I'm going to post a reply to my own post here, so if anyone is having the same issue in the future, they can have this as reference.

One possible solution is to create one field for each of the arrays. This formula field will iterate through the arrays, and it will have a string variable that you will concatenate the data to. Once your loop is finished, you just leave your concatenated string as your formula result.

It should look something like this:

======
global numberVar array myArray;
redim preserve myArray[20]; // resize the array to whatever it's size is, or crystal will complain
local numberVar i = 1;
local stringVar outStr;

for i := 1 to 20 do
(
    outStr := outStr + myArray + chr(10); // chr(10) is the \n char
);
outStr
======

Obviously fancy features like formatting are kind of limited for this solution, but it'll get the job done if you need something simple.

If anyone else has any other ideas, feel free to contribute.
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 04 Nov 2008 at 1:51am
Hi
 
Did you try Join function,not sure though if it will work..........
 
Join (list, delimiter)
 
Cheers
Rahul
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.