Search code examples
crystal-reports

Ceiling function for dates in crystal reports


I'm not even sure the ceiling function is what I need. Can it be run on dates? If not, is there a way to count in intervals from a date and show the most recent interval?

If I have a client that started with us on 4-15-2013 I need to count every 90 days and come up with the next upcoming after the date I ran the report?

Thanks


Solution

  • If I were doing this I would throw an expression similar to this at it. It's been awhile since I did anything with Crystal but using a combination of datediff, dataadd, and remainder functions you should be able to express it in a simple expression.

    The syntax isn't perfect, you'll need to clean it up but the concept should be there with this:

    DateAdd("d", (90 - Remainder(DateDiff("d",client_start_date,CurrentDate)/90)), CurrentDate)

    Basically it takes the difference between today and your key date, divides it by 90 to get the remainder, and then adds that remainder back to current date to get you the next date that falls on a 90 day cycle.