Solved

Crystal Reports Record/Group Selection

Posted on 2010-11-19
4
1,464 Views
Last Modified: 2012-05-10
I'm in need of some help with Crystal Reports (Ver. 2008). I have two tables...Company, and Notes. Company has a one to many relationship with Notes and each note has a "created date." An example view would look like this...

ABC, Inc.
     Note 1, 11/14/2010
     Note 2, 11/12/2010
     Note 3, 10/30/2010
XYZ, Inc.
     Note 1, 11/02/2010
     Note 2, 10/01/2010
     Note 3, 09/15/2010

I want to print only those Companies that have not had a Note added in the last ten days. Using the example above, ABC, Inc should not appear in the report...but XYZ, Inc should. Here are the steps I've taken so far...

1. Joined the tables
2. Created a report group that groups by Company.Comp_Name.
3. Created an "AsOfDate" Parameter field (that defaults to "today").
4. Created a "CompareDates" Formula Field that says...

whilereadingrecords
if {Notes.Note_CreatedDate} >= ({?AsOfDate}-10) then
    formula=False
else    
    formula=True
end if

5. Created a Group Selection formula that says "{@CompareDates} = True."

In a sense, this is working...but not the way I need it to work. Again using the above example, instead of omitting ABC, Inc from the report because one (or more) "Note" records do not meet the criteria, it includes it because "Note 3" does meet the selection criteria.

How can I get this report to omit "Company" records that have any "Note" records that do not meet the criteria?

Thanks for your help.
0
Comment
Question by:Bad_Fish
  • 2
4 Comments
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 250 total points
ID: 34178218
Try this idea

Don't use the group selection but use conditional suppression

in the group header
Right click the left margin
Click SECTION EXPERT
Click the formula button to the right of SUPPRESS
WhilePrintingRecords;
Global BooleanVar SuppressSection;
SuppressSection := {Notes.Note_CreatedDate} < ({?AsOfDate}-10)
SuppressSection

For the details and group footer use this formula for suppression
WhilePrintingRecords;
Global BooleanVar SuppressSection;
SuppressSection

mlmcc
0
 
LVL 34

Accepted Solution

by:
James0628 earned 250 total points
ID: 34179181
I think the basic problem is that you're trying to do a group selection, but the formula is looking at the value in a single record, so the result will probably be based on the first or last record in the group (based on your results, I guess it's the last record in the group).

 Try this for the group selection formula:

Maximum ({Notes.Note_CreatedDate}, {Company.Comp_Name}) < ({?AsOfDate}-10)

 That says to select the groups where the latest date for the group is more than 10 days before {?AsOfDate}.

 James
0
 

Author Comment

by:Bad_Fish
ID: 34201897
Mimcc, thank you. Your statement works fine in doing what I needed. However, without going into too much further detail, James0628's solution produced a "cleaner" result (having to do with suppressing the group footer when the header is suppressed). For the sake of brevity I won't elaborate here, but If you're interested, I'd be happy to host a remotes session to show you why.

James0628, thank you. Your statement did the trick nicely...and I learned a little too.

Thanks again to both of you.
0
 
LVL 34

Expert Comment

by:James0628
ID: 34203068
You're welcome.  Glad I could help.

 James
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
A short film showing how OnPage and Connectwise integration works.

929 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

10 Experts available now in Live!

Get 1:1 Help Now