Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Return Value based on Max Date Post Reply Post New Topic
Author Message
thummel1
Senior Member
Senior Member
Avatar

Joined: 27 Apr 2012
Location: United States
Online Status: Offline
Posts: 140
Quote thummel1 Replybullet Topic: Return Value based on Max Date
     Posted: 14 Feb 2014 at 5:19am

Hi, I'm using Crystal 2008.

 
Desired outcome. To return the the value (position Description) that's attached to the max date in a table.
 
My report is grouped by Employee ID (from EMPLOYEE table), then by Position level (in PAEMPPOS table, which has position # and it's respective position level). I have another table (PAPOSITION) that stores the description of each position. This table stores historical position descriptions and they have effective and end dates. My goal is to display the position description for the max effective date. See example of position description and eff/end date below:
Query2
POSITION DESCRIPTION EFFECT_DATE END_DATE
4858 7441F03030 6413OAKST 1807N 1/1/1950 3/17/2013
4858 7441F03030 6413OAKST 5131N 3/18/2013 4/28/2013
4858 7441F03030 6413OAKST 5641N 4/29/2013 4/29/2013
4858 7441F03030 5366386ST 5641N 4/30/2013 1/1/1700
Each employee is tied to a position#(one to many relationship). I need to pull in the MAX effective date (4/30/2013) for every record. I tried creating a Group on Effective date, ascending, but that isn't working right.
 
If you need more info from me I'll be happy to provide. Thanks!


Edited by thummel1 - 14 Feb 2014 at 5:19am
"Press any key to continue. Where's the 'Any' Key?" ~Homer Simpson
IP IP Logged
thummel1
Senior Member
Senior Member
Avatar

Joined: 27 Apr 2012
Location: United States
Online Status: Offline
Posts: 140
Quote thummel1 Replybullet Posted: 14 Feb 2014 at 5:24am

Holy Toledo I think I just got it. i just did a record sort expert, sorted on PAPOSITION Eff date, ascending, and it seems to be working! I will test this. Oh My, hope this works!

"Press any key to continue. Where's the 'Any' Key?" ~Homer Simpson
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Feb 2014 at 5:41am
You can also group on position and insert a summary as the max effective date for that group and conditionaly suppress the rows (detail section) in each group where
effective date<>max(effectivedate,position)
 
Note this does not remove the other rows, they are just suppressed (hidden).
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