Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Grouping by a date range (say.... by Month)

edited June 2003 in General
Hi:

I have a basic 1 table report that I would like to group by month for a
given date field.
Is there a way to handle this easily or do I need to create a calculated
field called Month and group based on that calculated field's value.

I am using D5, RB603.

Thank you

Bill Lawler
Elite Brokerage Services, Inc

Comments

  • edited July 2003
    Bill,

    Which database software are you using? In some databases, such as Access
    and MSSQL, there is a 'month' aggregate function that allows you to group a
    dataset by month based on a given date. Since, ReportBuilder allows you to
    group on datafields or calculated fields, you can use either one of the two
    to get the results you need.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2003
    Nico:

    I'm using Paradox dbs for this:

    I just found the following from Jim in the forum and it looks like it should
    cover me fine.
    I'll give this a try.

    Thanks for the response

    Bill Lawler

    "Try coding the TppGroup.OnGetBreakValue instead of using a variable. Using
    a
    variable is easier to do this visually, but since you are in code, it is
    easier to use the OnGetBreakValue event to build a string from the two
    fields form the pipeline and then all you have to do is set the break value
    in that event. No need for a TppVariable in this case.

    --
    Cheers,
    Jim Bennett
    Digital Metaphors"

  • edited July 2003
    In Paradox/BDE, you can use the Extract keyword to get the month from a
    field. See the Crosstab demos if you have RB Pro or Enterprise for an
    example of this SQL calculated field.

    For the year, it would be like this, and it would be similar for month
    calculations on the field in SQL:

    EXTRACT(YEAR FROM SaleDate) YEAR_FROM_SaleDate_Alias


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.