Mertech Blog

Crystal Reports Patch to Handle NULL Dates

Written by Mertech | Apr 30, 2013 5:25:00 PM

The Mertech Flex2SQL GUI migration tool and Mertech drivers use 01/01/0001 as the default NULL value for DataFlex DF_DATE and DF_DATETIME fields to be consistent with the DataFlex dummy zero date setting.


Note: The MSSQL drivers use 01/01/1753 as the default null value.
Note: The MySQL drivers (Windows versions 12.0.6020.0 and 12.1.6020.0 and SCO version 11.0.5702.1) were modified in March of 2012 to use 00/00/0000 as the default NULL value
.


Problem

Crystal Reports versions 9.0 and above have a lower date bound of 01/01/0100.

Solution

A solution is provided by Crystal Reports and described in ADAPT00175452 Patch ID: 36375929:

Description:

In reports, dates that are based on a DB2 table through ODBC, and have a date field with a value of 01/01/0001 (default value for NULL in DB2), are returned as 1/1/2001 in Crystal Reports 9.0 or higher. In Crystal Reports 8.5, the same report works successfully and its date is returned as 1/1/1.
The cause of the problem is that the date structure in CR 9.0 or higher has a lower bound of January 01, 100 AD. So, 01/01/0001 cannot be recognized as a valid value.

New Behavior:

The year is temporarily increased by the number of years (100 or multiples of 100), and then it is decreased by the same number of years when the date is converted to DateTime. This method corrects the dates.

Known Limitations:

Users must install the latest version of crw32.exe and crqe.dll, and then create a registry key to HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE as follows:

SoftwareCrystal Decisions9.0 or 10.0Crystal ReportsDatabaseNumberOfYearToShift=100 or multiples of 100 as a String value.

The patch does not create the registry key.