avatar image
Former Member

Need help with date formula in Crystal 2016

So I'm trying to filter my report to only show yesterday's date, I go to the formula editor and type:


{TimeTicketDet.TicketDate} = CurrentDate -1

Which results in the following error message "A string is required here"


So if I substitute CurrentDate for say "03/07/17", it works fine, but that's useless to me. I'd also like to be able to get last weeks results only (Mon thru Sat) and the current week thru yesterday

I'm pretty clueless as to how to accomplish all this. I know SQL pretty well, but none of my SQL statements work in Crystal. I've been looking for tutorials on youtube but I can't find an answer to my question


Wondering if someone here can help, thanks in advance

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Mar 08, 2017 at 08:00 PM

    Hi Ted,

    Crystal thinks the date in your database is a String type and not Date or DateTime. Try converting your field to a date like:

    CDate ({TimeTicketDet.TicketDate}) = CurrentDate -1; 

    Brian

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 08, 2017 at 08:00 PM

    Hi Ted,

    Crystal thinks the date in your database is a String type and not Date or DateTime. Try converting your field to a date like:

    If IsDate ({TimeTicketDet.TicketDate}) Then 
    CDate ({TimeTicketDet.TicketDate}) = CurrentDate -1; 
    Add comment
    10|10000 characters needed characters exceeded

Skip to Content