/scripts/ahub.form.attachments.js
0

Need help with date formula in Crystal 2016

Mar 08, 2017 at 07:43 PM

31

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Brian Dong Mar 08, 2017 at 08:00 PM
1

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

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thank you, this works great

0
Brian Dong Mar 08, 2017 at 08:00 PM
0

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; 
Share
10 |10000 characters needed characters left characters exceeded
Skip to Content