INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Displaying/Surpressing Groups based on Most Recent Record

Displaying/Surpressing Groups based on Most Recent Record

(OP)
I have a report grouped by Reference Number (see example below). I want to display any Reference Number groups when the most recent status is "Closed" and is within a given quarter. All statuses need to be displayed even when a date/time is outside the target quarter.

RefNo:    A219488

Status                DateTime
Open                3/28/2016 8:44:52 AM
Submittal Pending    3/29/2016 11:06:48 AM
Under Review        4/12/2016 1:56:49 PM
Submittal Pending    4/15/2016 10:41:20 AM
Under Review        4/23/2016 12:31:36 PM
Submittal Pending    4/27/2016 1:11:58 PM
Open                4/28/2016 10:25:08 AM
Submittal Pending    4/28/2016 10:25:18 AM
Under Review        6/15/2016 9:49:20 AM
Awaiting Approval    6/16/2016 10:37:18 AM
Closed                6/16/2016 10:37:26 AM

RE: Displaying/Surpressing Groups based on Most Recent Record

The only way you'll be able to do this is to use a Command, which is a SQL Select statement, or a Stored Procedure to get ALL of the data for the report.

What type of database are you connecting to? Can you go to Database>>Show SQL Query and post here the current report query? With that information, I can write a Command for you that will meet your needs.

Also, for more information about how to use Commands, see my blog post here: http://scn.sap.com/community/crystal-reports/blog/.... Also, I will be presenting a session on this topic at the ASUG BI and Analytics Conference next month in New Orleans.

-Dell

DecisionFirst Technologies - Seven-time SAP BusinessObjects Solution Partner of the Year
www.decisionfirst.com

RE: Displaying/Surpressing Groups based on Most Recent Record

Another method would be to create a SQL expression (syntax depends on CR version) like the following {%maxdt}:

(
select max(`date`)
from table a
where table.`refno`=a.`refno`
)

This will return the most recent dater per refno. Then create a formula {@maxdtclosed} like this:

if {table.date}={%maxdt} and
{table.status}="Closed" then 1

Then go to report->selection formula->group and enter:

sum({@maxdtclosed}, {table.refno})>0

Note that other data is still in the report, though not visible, so you should use running totals to capture any summaries instead of the more customary inserted summaries.

-lb

RE: Displaying/Surpressing Groups based on Most Recent Record

(OP)
Thanks for the input. I was able to get it to work using a Command.

-Rod

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close