We recently did a test upgrade from NAV2015 to NAV2017 and doing some testing of custom functionality. We noticed a strange behavior of the NAV System table 'Date'. Apparently the table does not filter correct on the boxes of the customer, while this behavior is not occurring on our test-server.
Here is a brief explanation of the issue:
Code:
UseOrderDate := 041417D;
Date.SETRANGE("Period Type",Date."Period Type"::Date);
Date.SETRANGE("Period Name",'Friday');
Date.SETFILTER("Period Start",'>=%1',UseOrderDate);
IF Date.FINDFIRST THEN
MESSAGE('Date = %1',Date."Period Start")
ELSE
MESSAGE('Date not found.');
Results:
- On our server the result is correct, as:
'Date = 04/14/2017.
- On the customer server (we tried a few different boxes, but same result):
'Date = 01/03/0001'.
According to the Customer's IT person and SQL specialist this behavior is not related to any SQL server setting.
The only difference is that we use 'SQL-2012' as our test server while our customer is using 'SQL-2016'.
I would assume that SQl-2016 is compatible with NAV2017. (build: 10.0.14199).
Any ideas?
0
Comments
B3 Technologies - Making Technology Serve the People
If you can consistently replicate the issue then I'm sure Microsoft would be interested in hearing from you so it would be very worthwhile raising a support issue with them.
If this was a localisation issue and 'Friday' was not a valid "Period Name" then you would expect no records to be found and therefore the 'Date not found' message to be shown.
I suggest you to test if the code below will help you:
// UseOrderDate := 041417D; // help the code to understand it is 2017
UseOrderDate := 04142017D;
Date.SETRANGE("Period Type",Date."Period Type"::Date);
// Date.SETRANGE("Period Name",'Friday'); // use "Period No." instead
Date.SETRANGE("Period No.", 5);
Date.SETFILTER("Period Start",'>=%1',UseOrderDate);
IF Date.FINDFIRST THEN
MESSAGE('Date = %1',Date."Period Start")
ELSE
MESSAGE('Date not found.');