Solved

Selecting the Most recent last performed date for each record

Posted on 2016-09-29
3
13 Views
Last Modified: 2016-10-18
I had this question after viewing Maximum date for Crystal Reports.

I need to be able to select only the most recent complete date for each record.  I have tried everything I can think of and have failed miserably so far.  This can't be this hard.  I have tried everything I could find on the site.  Any help would be great.

Thanks
Rich

PM_ID_NUMBER      PM_GEN_WO_NUMBER      PM_DUE_DATE      PM_COMPLETE_DATE
00006514      00224806      20161231      20151201
00006514      00209934      20161231      20141208
00006514      00195108      20161231      20131216
00006514      00181568      20161231      20130204
00006514      00177627      20161231      20121115
00006515      00223658      20161130      20151027
00006515      00188866      20170731      20130701
00006515      00190107      20170831      20130819
00006515      00183780      20170331      20130321
00006515      00185105      20170430      20130401
00006515      00186295      20170531      20130506
00006576      00231802      20160930      20160516
00006576      00228092      20160930      20160301
00006576      00224832      20160930      20160104
00006576      00221174      20160930      20150910
00006576      00217433      20160930      20150608
00006576      00213522      20160930      20150311
00006576      00210092      20160930      20141215
00006577      00223670      20161130      20151102
00006577      00223671      20161130      20151102
00006577      00216222      20161130      20150604
00006577      00216223      20161130      20150506
00006577      00208837      20161130      20141110
0
Comment
Question by:RDMcLaurine
  • 2
3 Comments
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 500 total points (awarded by participants)
Comment Utility
If you are simply trying to display the dat you can do this with groups.

Add a group on PM_ID_NUMBER
Add a sort on PM_COMPLETE_DATE
   Make the sort descending
Put the fields in the group header rather than the detail section
Suppress the details and group footer


This works if you only are displaying the data as the report shows.
If you are doing any summaries or other calculations on the data then this idea fails because all the data is still in the report.


I attached a sample report

mlmcc
MaxDateData.xls
MaxDate-by-Grouping.rpt
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points (awarded by participants)
Comment Utility
You can also use a COMMAND for the data source.  The SQL for it will be something like this

SELECT T1.PM_ID_NUMBER, T1.PM_GEN_WO_NUMBER, T1.PM_DUE_DATE, T1.PM_COMPLETE_DATE
 FROM   YourTable T1
WHERE T1.PM_COMPLETE_DATE =  (SELECT MAX(T2.PM_COMPLETE_DATE) FROM  YourTable T2 WHERE T2.PM_ID_NUMBER = T1.PM_ID_NUMBER )

Open in new window


mlmcc
MaxDate-using-a-Command.rpt
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
This video discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now