Last Record of Month

edited October 2017 in General
Using Delphi XE, NexusDB 3.x database and ReportBuilder 14.x.

I need to select records for the last day of each month.

I have a table with records having a Date Field called RepDate. These
records are generated each day as part of an end of day processing. I
need to make a report that selects only the last record for each month.
The RepDate may be the last day of the month, or not the last day of
the month because sometimes the stores are closed on the last day of
the month (for example, if that day is Sunday or a holiday). How do I
do this? What is the best approach?



  • edited October 2017
    Hi David,

    This will likely need to be handled on your DB. SQL Server, for
    instance, has the EOMONTH call to retrieve the last day of the month.
    Other DB’s likely have similar features.

    Best Regards,

    Nico Cizik
    Digital Metaphors
  • edited October 2017
    Nico Cizik (Digital Metaphors) wrote:

    That is not really what I need, the last day of a month, because the
    record for the last day of the month may not exist. What I am thinking
    is sorting by date and using a group and filter somehow, but not
    exactly sure how. Is there some way to mark each record not to print
    as it processes through if the next record is part of the same month?
    How exactly could this be done?
This discussion has been closed.