Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Problem performing a summary on a calculated field Post Reply Post New Topic
Author Message
SamB
Newbie
Newbie


Joined: 08 Jun 2009
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote SamB Replybullet Topic: Problem performing a summary on a calculated field
    Posted: 08 Jun 2009 at 4:36am
Hi

Firstly, I'll just say that I'm quite new to Crystal Reports, so if I'm asking a dumb question, please forgive me, and you may have to answer in easy language!

The problem I'm having is performing a summary on a field which has already been calculated. For example, I create a report which is grouped by customer, and I do a count, placed in the group footer, to show how many orders each customer has placed.
I then want to do something to show how many customers have placed one order, how many have placed two orders, how many placed three, etc etc. This is where I hit a snag and it doesn't work.

Any help?

Thanks
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 08 Jun 2009 at 6:27am
What makes the solution difficult is how many orders a customer can have.
 
What I would suggest, is to use an array (unfortunately, I don't use these) or a delimited string.  The array, I think allows you to resize it.  If you know the max number of orders, you can either 1 set the array size, set the delimited string, or set a list of shared variables.
 
regardless, of how you store the data, the next step would be in the group footer to create a formula that will increment the array/string/shared variable.
 
At the end of the report, you would have a several formulas to display back the results of the array/string/shared variables.
 
Sorry I can't be more specific, without knowing a limit, it becomes hard to determine a solution.
IP IP Logged
SamB
Newbie
Newbie


Joined: 08 Jun 2009
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote SamB Replybullet Posted: 08 Jun 2009 at 7:16am
Thanks for that. One of the tasks I'm trying to accomplish is basically to say whether the number of orders is a) 1, or b) more than 1. Does that make it any simpler?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 08 Jun 2009 at 8:25am
that would be much simpler.
 
since you would be able to determine that by something like:
if count({table.orderfield}, {group}) = 1 then
  //increment the 1 order field
else
  //increment the multi order field.
 
 
since I use them a lot, I would use shared variables.  They are pretty easy, check Crystal Help, or just about any post that I have done...Like I said, I use them A LOT :)
IP IP Logged
SamB
Newbie
Newbie


Joined: 08 Jun 2009
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote SamB Replybullet Posted: 08 Jun 2009 at 8:33am
Thanks!

I've actually managed to bodge something together using this: http://articles.techrepublic.com.com/5100-10878_11-5072153.html  in the meantime, but your idea sounds like it will be better in the long run, so I'll have a run at it!
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.