Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Sum of Array Data Post Reply Post New Topic
Author Message
siweltj
Newbie
Newbie


Joined: 13 Sep 2007
Location: United States
Online Status: Offline
Posts: 16
Quote siweltj Replybullet Topic: Sum of Array Data
    Posted: 13 Sep 2007 at 10:31am
I have a field that contains data such as described below:
 
"AM1,CS1,XW1"
 
I want to count each of these variables independently.  Such as a count of all "AM1" and a count of all "XW1"
 
When using the Split function I get "The result of a formula can not be an array."
 
Can anyone steer me in the right direction on a solution?  Thanks
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 13 Sep 2007 at 1:19pm
Yeah, this a bit of a pain. You have to do the counting manually. Create a formula which splits the string apart and then loop the array and count how many times each element appears. In fact, you're going to have to create a new array that tracks these counts. Put this in a shared variable. After that, you can have a formula that just returns one element from the array. You could also create a function which is passed the element number and it returns the count and text for each element. Anyway, this is going to take a bit of coding and some expertise to pull off. But I don't see any other way.
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
sunij
Newbie
Newbie
Avatar

Joined: 18 Sep 2007
Location: India
Online Status: Offline
Posts: 8
Quote sunij Replybullet Posted: 18 Sep 2007 at 2:10am

There are two ways to achieve this....

Lets assume that ur values are under the column name "Data" then
 
1. U can group the "Data" field and besides u can have a summary field which will count the occurences.
 
2. Use a cross tab in which the "Data" field should be in the row box and the same can be used in the data box with the summarization as count.
 
 
Let me know if this answers ur query
Thanks,
Sunil Jith
IP IP Logged
siweltj
Newbie
Newbie


Joined: 13 Sep 2007
Location: United States
Online Status: Offline
Posts: 16
Quote siweltj Replybullet Posted: 18 Sep 2007 at 3:39pm
Thanks for the input.  Both your suggestions work with the exception that some of the data sets have more then one entry, such as WH1,AM1.
 
Both your suggestions work well for grouping data sets with only one variable, but with two variables both need to be counted seperately.  Essientially I need to pull variables such as these apart and count them indepedently.  And that is where I get stuck.
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.033 seconds.