Solved

Crystal Reports Record/Group Selection

Posted on 2010-11-19
4
1,465 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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 …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

770 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