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

Groups

edited November 2007 in End User
Hello,

I have a Datafield as a DateTime in my Database and a function CalendarWeek
(DT: DateTime) which returns a Integer (the calendar week). Now I want to
group by the calendar week, but it doesn' t work.
what could be the problem?

Regards Manuel Neubauer

Comments

  • edited November 2007
    Hi Manuel,

    The ReportBuilder QueryDesigner does not allow grouping by a calculated
    field due to the fact that this is not supported by all SQL engines. You
    will need to manually edit your SQL code in order to group by a calculated
    field from DADE.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2007
    What else is the function 'group by userdefined field' for??


  • edited November 2007
    Hi Manuel,

    I'm unclear about your question. Please give me more information about
    exactly what you are trying to accomplish and which features of
    ReportBuilder you are using. Also, please define which version of
    ReportBuilder and Delphi you are using when asking a new question.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2007
    ReportBuilder Enterprise Edition
    Version 10.06

    I have a Date in my Database and a function which calculates the Calendar
    week for each Date.

    Group Header [Variable]
    ----------------------------------------------

    Variable [getCalendarWeek (DB.Date)] (I want to group by this
    function)

    Detail
    ----------------------------------------------
    Group Footer [Variable]
    ----------------------------------------------

    Output

    Calendar Week 28 ....
    ....
    ....

    Calendar Week 29 .....
    .....
    .....



  • edited November 2007
    Thank you for the clarification. The issue with grouping on a TppVariable
    is that the OnCalc event fires too late for the group to pick up a change.
    If you were to change the value before the DetailBand prints, the group
    would break as expected. Although we do not usually recommend making
    calculations outside a TppVariable.OnCalc event, I would suggest trying this
    and seeing if it gives you the correct effect. If not, you may need to
    re-design your dataset so you are able to group by the calendar week in your
    dataset, rather than a custom field.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2007
    Now I tried to calculate the Variable in the Detailband (BeforePrint), but
    the grouping also doesn?t work.

    Have you got any Example how to use the 'userdefined grouping' function?
    What is the function to group by a variable for, if it doesn?t work?

    Regards

    Manuel Neubauer



  • edited November 2007
    Do to the timing of when the group break value is checked by the report
    engine, you need to use either the Group.OnGetBreakValue event or the
    Variable.OnGetText event.

    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2007
    But the report doesn't group! The Group.OnGetBreakValue is executed on every
    Dataset...

  • edited November 2007

    - for the Query, add an Order By caluse that sorts the data by the grouping
    field. RB will not do that for you.

    - the report engine will traverse the datapipeline to which it is assigned.
    Group.OnGetBreakValue gets called quite frequently - it is called by any
    code that need to check the value fo the group.

    - when the report engine detects that the group value has changed then it
    will generate a group break.


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2007
    But I have the data in the correct order like:

    CalendarWeek 9 - 9 - 9 - 10 - 10- 12 - 13 - 13 -13 - 13 ... and the report
    builder prints the group header only at the page header.
    I also looked at the OnGetBreakValue and there are correct values in!

    Regards,
    Manuel Neubauer

  • edited November 2007

    There are no known issues with groups. If you would like to create a simple,
    focused example, please use standard Delphi components and RB. Use the
    DBDemos data or dump some of your data out to TClientDataSet. Send in zip
    format to support@digital-metaphors.com. Please create a simple example, and
    please do not send your actual report.



    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.