Grouping / Record Selection Question for Crystal Reports XI

Posted on 2011-10-27
Last Modified: 2012-05-12
Hello Experts,

I am working on a Crystal Report (version XI) that queries an Oracle database and is grouped by the following fields:

Court Date (for each day)
Judge Name
Case Number
Charge Number

The report is run for a date range that covers several months, so case numbers appear on the report multiple times if there are multiple court dates/judges for a single case number within the report date range. I'm wondering if there is a way, while maintaining the current grouping, to display case numbers only once for the most recent court date.

Additionally...I don't know if this is relevant to my question above...but the report is only displaying cases in which specified fields have null values. This is accomplished by using the following formula:

numberVar Nulls;
if (isnull({PTYCHRG.DCSN_CD}) and isnull({PTYCHRG.DCSN_DT})
and isnull({PTCGDSP.DSP_DT}) and isnull({PTCGDSP.CG_DSP_CD}))
then Nulls := 0
else Nulls := 1

and then using the following group selection statement to suppress records:
Sum ({@Nulls}, {CASE.DSCR}) = 0

Thank you!!

Question by:jsmith08
    LVL 1

    Accepted Solution

    Check out the Oracle Analytic Functions. You could write a SQL Command looking something like:

    select * from (
        select date
            , max(date) over (partition by judge_name, case_number, charge_number) as max_date
    ) where date=max_date
    LVL 100

    Expert Comment

    Are you looking to show the case only for the last activity?

    Do you need the information from the rest of the case for summaries or other analysis?


    Author Comment

    I need the report to group by the court date and Judge for the last court date available in the database for the case.  I don't need any other court date and Judge information.

    Author Comment

    The other charge information that I'm using in the report will be the same regardless of the court date and Judge.
    LVL 100

    Expert Comment

    Have you tried using the Group Select with  TOP 1 based on the date?


    Author Comment

    No, I have not tried that yet.  I'll see how that works.
    LVL 19

    Assisted Solution

    You could try creating a SQL Expression, I'm not good on oracle syntax but it woudl be something like

    select maximum(A.court_date)
    from table A
    where A.case_number= table.case_number

    you can then add this to your record selection formula to filter the correct records i.e.

    table.court_date = {%MaxCourtDate}

    LVL 100

    Expert Comment

    This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    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…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    761 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

    7 Experts available now in Live!

    Get 1:1 Help Now