Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: How to filter a main report based on data in a sub Post Reply Post New Topic
Author Message
NCGOV
Newbie
Newbie
Avatar

Joined: 04 Oct 2016
Online Status: Offline
Posts: 24
Quote NCGOV Replybullet Topic: How to filter a main report based on data in a sub
    Posted: 16 Aug 2017 at 10:52am
I am working on a report that consists of a main and sub report. The main report is grouped by name field. The sub-report is LWMAIN data. Currently I am using a shared variable formula to show the number of offenses a person has. I want to display in the main report only those persons with more than one offense listed in the sub-report.
How can I filter the main report to display only this data? If there is an easier way let me know. The reason I have a sub-report is so that I can work with the data better.


Main report formula -

WhilePrintingRecords;

shared numbervar x;

x;


Sub-Report Formula -

WhilePrintingRecords;

shared numbervar x;

x := 0;

x := Count ({lwchrg.chrgdesc});

x;



Edited by NCGOV - 17 Aug 2017 at 5:30am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Aug 2017 at 5:07am
I would not use the sub report but if you have to you will need to do suppression not selection.
The easiest thing is likely a stored proc or crystal command that would do the grouping and counts in the data source then you can select from that.
If not you can link the incidents to the person in the main report, group on the person and the incident type and do some group summary counts to do group selection.
The sub report gets tricky more resource intensive but is plausible.
Will the above options work rather than the sr?
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.