Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: limit records of field in detail section Post Reply Post New Topic
Author Message
abdulmoiz
Newbie
Newbie


Joined: 03 Mar 2013
Online Status: Offline
Posts: 3
Quote abdulmoiz Replybullet Topic: limit records of field in detail section
    Posted: 03 Mar 2013 at 10:12pm
Hello,

I have a report which contains a field named Code. I am displaying this field in my details section. I need to limit the number of records displayed in this field to 3. i.e. I want to display only top 3 records in this field.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 04 Mar 2013 at 4:23am
How do you define the top 3?  If it's based on a summary of some data (sum, count, etc.), search in the Crystal help for "Top N" and follow the instructions there.  If it's not based on a summary, try this:
 
1.  Sort the data descending on the field you're looking at.  This sort will happen inside whatever groups you already have defined.
 
2.  Create a Running Total (I'll call this {#RecCount}):
Field to Summarize:  Some key field in the details.
Type of Summary:  Count.
Evaluate: Every Record.
Reset:  On change of group - whatever the inner-most group is that the details are based on.
 
3.  Go to the Section Expert.  Click on the formula button to the right of the Suppress checkbox (DO NOT check the checkbox!).
 
4.  Enter the following formula:
 
{#RecCount} > 3
 
This should give you just the top three records in the group.
 
-Dell
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Mar 2013 at 4:24am

how are you getting the data into the report?

Are you grouping and you want the top 3 per group?
you can insert a running total that counts any field in the grup and resets at the group level then suppress the detail section based on this (e.g. #RT >3)
 
EDIT: Sorry Hilfy, was typing mine up when you posted Confused


Edited by DBlank - 04 Mar 2013 at 4:25am
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 04 Mar 2013 at 4:53am
No problem Smile
 
-Dell
IP IP Logged
abdulmoiz
Newbie
Newbie


Joined: 03 Mar 2013
Online Status: Offline
Posts: 3
Quote abdulmoiz Replybullet Posted: 04 Mar 2013 at 10:16pm
yes, i am grouping data by patientID and then by Service Dates

and in each service date, i have CPT Codes and ICD Codes. My Requirement is to Limit the number of ICD Codes to 3. Now, my report has varying ICD Codes for Service Dates.

Thanks in advance.
IP IP Logged
abdulmoiz
Newbie
Newbie


Joined: 03 Mar 2013
Online Status: Offline
Posts: 3
Quote abdulmoiz Replybullet Posted: 04 Mar 2013 at 11:47pm
please find the detailed report output needed on this link:

https://docs.google.com/file/d/0BwFk9lyWmytlLTN0NkxycGlMaWs/edit?usp=sharing

Thanks
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.