Print Page | Close Window

Top N (1) In Sub Report?

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2022
Forum Name: Tips and Tricks
Forum Discription: Have you learned some great tricks to share with the group? Post them here!
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=12369
Printed Date: 10 Nov 2024 at 8:50am


Topic: Top N (1) In Sub Report?
Posted By: jamesklett
Subject: Top N (1) In Sub Report?
Date Posted: 18 Feb 2011 at 7:49am
I cannot get the Top N feature to work in my Sub Report. 
 
Suppose I have a master rfeport showing Employees, and I have a Sub-Report that show all their related Timecards.  But, I only want to show their most recent n timecards.  n can be 1 for this example.  When I add the group, and the summary in the sub report and then use the Group Select top n feature, the report still pulls all timecards, not just the top n.  I am guessing that this is because of the Sub-report Links from the master report override the top n, but then how can I do what I need to do here?
 
Thanks,
 
JIM



Replies:
Posted By: hilfy
Date Posted: 21 Feb 2011 at 8:02am
If you want to show just the most recent timecard you can do the following:
 
1.  Group on Employee ID - there should be only one value for this in the subreport, but it helps us get the format we need.
 
2.  Order descending on the date of the Time Card.
 
3.  Put all of the data in the group header - this will show only the most recent time card.
 
If you need to be able to show more than 1, it gets a bit more complicated, but it can be done.
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics



Print Page | Close Window