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

Grouping by day

edited April 2012 in End User
?Hello,

I have a datasource containing timestamps of the form dd/mm/yy hh:mm:ss,
and want to create a group by day. Grouping by the timestamp switched
every change in time, which is not what I want.

My initial attempt is to create a variable (Variable1) in the detail
band, with OnCalc of:
Value := Trunc(DBPipeline3['PATI_TStampCR']);

Variable1, displayed in the details band as an integer, does appear
correctly.

I then create a group on Custom field Variable1 (truncating the date in
this manner gives the date and omits the time part). Unfortunately it
doesn't work though, with no group break triggered. I assume that the
problem is that the Variable1 doesn't get calculated at the time the
group is broken, hence it is always the same value.

Can anybody suggest a tweak to get this to work, else another possible
means of breaking by day?

Many thanks
Keith



--- posted by geoForum on http://www.newswhat.com

Comments

  • edited April 2012
    Hi Keith,

    Rather than using a TppVariable and the OnCalc, try using a TppLabel and
    the OnGetText event.

    Text := IntToStr(Trunc(Report.Pipeline('PATI_TStampCR')));

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2012
    Hi Nico,

    That's fantastic, thanks very much.

    I've used a slight variation:
    Text := DateTimeToStr(Trunc(DBPipeline3['PATI_TStampCR'])); ?

    The preview panel otherwise shows the Timestamp format (40908 etc.).
    The group break works in the same way because it is looking for a change
    in date (doesn't need to string sort), and the data is of course pre-
    sorted by date.

    Have a great weekend.

    Best regards
    Keith



    --- posted by geoForum on http://www.newswhat.com
This discussion has been closed.