Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suppress rows based on a condition 1

Status
Not open for further replies.

swiss2007

Technical User
Aug 13, 2007
92
US
I have a report structure like

GH1 ClassID
GH2 Description
GH3 SalesRepName
Details
GF1
GF2
GF3

Detail level data is as

ClassID Description SalesRepName StartDate
1 High Michael Greene 08/01/2008
1 High Tren Malle 08/03/2008
1 High Richard Menn 07/03/2008
1 High Richard Menn 07/04/2008
1 High Richard Menn 07/05/2008
1 Low Tren Malle 06/02/2008
1 Low Drew Young 06/01/2008
1 Medium Drew Young 06/26/2008
1 Medium Eric Jean 05/26/2008
1 Medium Tren Malle 02/22/2008

2 High Joseph Lee 08/17/2008
2 High Dere Este 01/14/2008
2 Medium Dere Este 02/21/2008
2 Low Duke jones 03/13/2008
2 High Pierro Santo 10/01/2008
2 Low Pierro Santo 11/04/2008
2 Low Bob Brenn 11/06/2008
2 Medium Hiro Wu 12/08/2008
2 Medium Pierro Santo 12/08/2008

for a particular Group ClassID,Group Description,Group SalesRepName
when startDate = max(StartDate) then
1) Capture the row with ClassID,Description,SalesRepname,StartDate
2) if Description = Medium for a person.
then all the rows for that person have to be suppressed.
3)No Rows with Description = Medium are to be seen.

The output expected is
ClassID Description Salesrepname StartDate
1 High Michael Greene 08/01/2008
1 High Richard Menn 07/05/2008

2 High Joseph Lee 08/17/2008
2 Low Bob Brenn 11/06/2008
2 Low Duke jones 03/13/2008

Many Thanks
 
Hi,
Use a selection criteria formula like:
{Description} <> 'Medium'




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
if Description = Medium for a person then all the rows for that person have to be suppressed.
First, group by Person.

Do a 'maximum' summary value for Description for the group. If it is Medium, suppress the group. Group Selection under Report > Selection Formula should work.

If there were some other value that would be greater than 'Medium', you'd need a formula,
Code:
if Description = "Medium" then 1 
else 0
Summarising that would give you 1 or more if there are rows with Medium.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
PS. It helps to give your Crystal version - 8, 8.5, 9, 10, 11 or whatever. Methods sometimes change between versions, and higher versions have extra options.


[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
I think you'd have to do this in two steps. Assuming you are grouping by class ID, description, and then salesrep, go to report->selection formula->GROUP and enter:

{table.date} = maximum({table.date},{table.salesrep}) and
{table.description} <> "Medium"

Although this will eliminate the display of any Mediums, it doesn't rule out salesreps that have a medium record. To do this, I would insert a subreport in the salesrep group header_a that contains the records grouped only by salesrep. Then create a formula {@med}:

if {table.description} = "Medium" then 1

Then create a second formula to place in the subreport report footer:

whileprintingrecords;
shared numbervar med := sum({@med});

Link the subreport to the main report on the salerep field, and then go into the section expert->detail->suppress->x+2 and enter:

whileprintingrecords;
shared numbervar med;
med > 0

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top