I have a report which has only one data source table, a Command that contains the following SQL query:
Select i.InvoiceNumber, i.InvoiceDate as InvoiceDateTime , Cast(i.InvoiceDate as date) as InvoiceDateString FROM Invoice i
When I generate the report in SAP Crystal Reports 2020, my Command.InvoiceDate field is returned as a DateTime data type and InvoiceDateString is returned as a String [10] data type.
I have a formula named CDate in the report that gets the day from Command.InvoiceDateString:
day(cdate({Command.InvoiceDateString}))
When I preview the report in SAP Crystal Reports 2020, the formula returns the day as a number, which is expected.
However, when I run the same report in Crystal Reports Viewer (CR Runtime 13.0 sp33) , I received the error
Error in formula CDate:
'day(cdate({Command.InvoiceDateString}))
'
A date-time is required here.
Workaround: If I use the DateTime field, Command.InvoiceDateTime, then it works fine.