Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Picking one record of a group? Post Reply Post New Topic
Author Message
Tim Wise
Newbie
Newbie
Avatar

Joined: 29 Apr 2008
Location: United States
Online Status: Offline
Posts: 31
Quote Tim Wise Replybullet Topic: Picking one record of a group?
     Posted: 02 Jun 2008 at 7:55am
I'm trying figure out whether I can do this in a group or a cross-tab.
 
The example: Sales records with fields: month, salesperson, $sold.
 
I want to create a monthly summary. I group by month and in the footer put summaries for the total $sold and the max $sold.
 
Can I also print the salesperson who sold the max?
 
I want to create a summary field that picks the max $sold yet prints the salesperson field. You can so something similar in the group options where you group on one field but display another.
 
Any help is appreciated.
--
Tim
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 02 Jun 2008 at 5:30pm
By default, Crystal Reports can't match the data that belongs with the record that has the Max() value. I haven't tried this, but I think there would be a way to trick it. I would try creating a formula which has a Global string variable which stores the salesperson name. Compare the current sales values to the Max() value and if they match then assing the salesperson name to the string variable. Print the string variable in the group footer (and reset it to "" in the group header) and I think this will do it.

I have three chapters dedicated to writing custom formulas in 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
Tim Wise
Newbie
Newbie
Avatar

Joined: 29 Apr 2008
Location: United States
Online Status: Offline
Posts: 31
Quote Tim Wise Replybullet Posted: 02 Jun 2008 at 8:00pm
By default, Crystal Reports can't match the data that belongs with the record that has the Max() value.
I figured that was probably the case.
 
Compare the current sales values to the Max() value and if they match then adding the salesperson name to the string variable.
I'll try that.
 
Makes me wonder about how many times the Max will be computed. In the worst case, it could be re-computed for every record of a group.
 
I have three chapters dedicated to writing custom formulas in my Encyclopedia book.
I'm planning on getting a copy. Maybe the online version. Have you started the CR 2008 book yet?
 
Thanks.
 
--
Tim
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 02 Jun 2008 at 8:22pm
Yes, I've written four chapters of the CR 2008 book so far. My attention has been diverted recently due to SAP's acquisition of Crystal Reports. I'm now undergoing heavy training in SAP so that I can write about the data integration aspects with CR. I will start on the next chapter once I get back from visiting SAP this week for a developers competition.
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
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