Solved

Crystal Reports Record/Group Selection

Posted on 2010-11-19
4
1,470 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 101

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 35

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 35

Expert Comment

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

 James
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

630 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