Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Multiple Maximum fields for groups Post Reply Post New Topic
Author Message
kj27
Newbie
Newbie
Avatar

Joined: 15 Mar 2010
Location: United States
Online Status: Offline
Posts: 9
Quote kj27 Replybullet Topic: Multiple Maximum fields for groups
     Posted: 16 Mar 2010 at 9:29am
I have a sub-report where I am grouping by an ID field (Opportunity.ID). The primary reason for this is that I want to display the last activity associated with that opportunity. So in the Group Selection formula, I have:
 
{HISTORY.COMPLETEDDATE} = Maximum({HISTORY.COMPLETEDDATE}, {OPPORTUNITY.ID})
 
This works like a charm.
 
The problem now is that I also need to show the next activity related to this opportunity - so the Maximum(ACTIVITY.STARTDATE).
 
Is it possible to select more than one maximum field, and if so, what would the syntax look like?
 
Thanks
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 17 Mar 2010 at 3:34am

Since it sounds like you only need to display, not group on, either create a formula or use an aggregate to display the Maximum({Activity.StartDate}, {Opportunity.ID})

HTH
IP IP Logged
kj27
Newbie
Newbie
Avatar

Joined: 15 Mar 2010
Location: United States
Online Status: Offline
Posts: 9
Quote kj27 Replybullet Posted: 17 Mar 2010 at 3:56am

Thanks!

I see your point and just tried it this way and it works to a certain extent. By getting rid of the grouping, I do get just the two max values via two formulas.
 
But the grouping is needed - because now only one opportunity record is displayed per Account. An account can have 0 to Many opportunities. And for each of those opportunities, I would need to display the Max Activity and Max History dates.
 
I'll look up how to do aggregates - but I hope this explains the main issue.
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