Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Arrays, maybe Post Reply Post New Topic
Author Message
philbew
Newbie
Newbie


Joined: 26 Feb 2008
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote philbew Replybullet Topic: Arrays, maybe
    Posted: 25 Mar 2008 at 4:55am
Hi all,
 
Fairly new to crystal and new to this forum, so hi to all.
 
I am writing a report to get manufacturing times against products and sumerize these by times taken in each department.
 
I can get a list of all the department names (currently 61) and am currently doing this in a sub-report at report header level.
 
During the main report detail stages I will get times against some of the same department names and on each re-accurance of that department name want to sum the total so far.
 
At the end of the report, in the footer perhaps, I will then display each used department name and its grand total of time taken
 
I though genertating an arrray of the department name to then hold times against would do the trick, but cannot work out how to add numeric times to an array holding text names.
 
Any help or other ideas greatly appreciated
 
Cheers
 
Phil
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 25 Mar 2008 at 9:10pm
Welcome Phil!

You are having this problem because Crystal Reports doesn't let you use multi-dimensional arrays. You really need to have the first index be the department name and the second index be the time. The way to get around this is to use two arrays that stay in synch using a common index variable.

So in the subreport build the first array (a Shared variable) with the department names. Then as you go through the Detail records use a formula which loops through the first array to find where the current department name is in the index. Then use this number to add the time to the second array. That lets the two arrays stay in synch and the location of the department names match the location of the times in the second array.

I cover arrays and and give sample code for working with them in Chapter 7 of my Encyclopedia book. You can find out more about my books at Amazon.com or reading the Crystal Reports eBooks online.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
philbew
Newbie
Newbie


Joined: 26 Feb 2008
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote philbew Replybullet Posted: 26 Mar 2008 at 12:50am
Brian,
 
Many thanks for your answer, will give that a go.
 
Order for your book on its way to Amazon.
 
Cheers
 
Phil
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.047 seconds.