"The date is not valid"

Henrik698Henrik698 Member Posts: 12
Hi,
I am using a Business Central version 14.5.
I am running a report in the job queue. The report is a processing only report, i.e. no RDLC layout.
When running in the job queue, the report fails with an error: "The date is not valid".
Tragically, turning the debugger on does not reveal where the error happens. The arrow just points at the line in codeunit 449:

REPORT.EXECUTE(ReportID,JobQueueEntry.GetReportParameters);

It is strange that when running the report manually, it does not generate an error.

Does anybody out there perhaps have an idea regarding this? Thanks in advance for any hints.

Best Answer

  • Henrik698Henrik698 Member Posts: 12
    Answer ✓
    I have found the reason.
    The report iterated through a table with a field of the type "datetime" in SQL but the type "date" in BC. Due to some integration, the field in the SQL table had a date value BUT ALSO a time value. This latter (the time value) caused BC to refuse to iterate past the record with a time in the field. This gave the error message "The date is invalid" and the debugger refused to point it out.

Answers

  • SanderDkSanderDk Member Posts: 502
    I think you have invalid data in your report parameteres.
    For help, do not use PM, use forum instead, perhaps other people have the same question, or better answers.
  • Henrik698Henrik698 Member Posts: 12
    Thank you for the suggestion. I don't think that is the explanation because there are no date filters or anything with dates in the report parameters. It is an xml file and I have tried to regenerate it from scratch, still the same result. I have also examined it and there are no errors in the xml, it seems.
  • Henrik698Henrik698 Member Posts: 12
    Answer ✓
    I have found the reason.
    The report iterated through a table with a field of the type "datetime" in SQL but the type "date" in BC. Due to some integration, the field in the SQL table had a date value BUT ALSO a time value. This latter (the time value) caused BC to refuse to iterate past the record with a time in the field. This gave the error message "The date is invalid" and the debugger refused to point it out.
  • PascualPascual Member Posts: 9
    Good morning, just as a suggestion of where the problem may have come from
    Is it possible that the standard feature U31/12/2022 is used in a table that was not prepared for this?
  • Henrik698Henrik698 Member Posts: 12
    Thanks, that's a good suggestion. But in this case, I don't think that was the explanation. The situation is that the SQL table gets populated through an integration with some 3rd party software. Most likely, the "erroneous" data came from here.
  • lubostlubost Member Posts: 623
    In Date type fields must be time part in SQL column zero (00:00:00). Check SQL data.
Sign In or Register to comment.