In Business Central as from version 20, which is 2022 Wave 1, when you develop a report without a layout and try to run it, like this one:
the following error appears:
Sometimes the error is different:
Report x does not have a layout of type Excel.
Normally and in previous versions of Business Central the request page would show and allow you to export the dataset to Excel, for analysis.
As a developer, before I add any layout to a report, I create the dataset (data items and columns), and then want to look at the runtime dataset to see if it’s good. Only then I add 1 or more layouts to the report.
Well, this is not possible anymore.
How can we fix this?
You need to add at least one layout to the report, for example:
and when you then run the report, the following error appears, again:
So what’s the solution?
You need to also add the DefaultLayout property, like so:
and then you can run the report, and export the dataset:
So you need to provide at least 1 layout, even if it’s empty, before you can run a report.
I documented this as a bug here:
Can not run reports without a layout anymore? · Issue #7020 · microsoft/AL (github.com)
Hopefully this will be fixed soon (BC 20.1), because I think it’s ‘suboptimal’ to have to create a layout simply to be able to export the dataset.
There are a few other errors happening in BC 20 that, I think, are related:
- The report couldn’t be generated, because it was empty. Adjust your filters and try again – Dynamics 365 Business Central Forum Community Forum
- The system function “Report.SaveAs” does not work with type “Xml” anymore · Issue #6985 · microsoft/AL (github.com)
- Erik Hougaard on Twitter: “Anyone seen this? A report than ran without issues on #msdyn365bc v19, gives this error straight out of Report.RunModal() after tenant upgraded to v20: @KennieNP @JesperSchulz – What does that even mean “Report does not have a layout of type None” – Very nihilistic? https://t.co/9JYe5B2LK6″ / Twitter
Another possible solution:
A possible solution, for the other errors mentioned here above, is in BC to open the new Report Layouts page and set a default layout:
Discover more from think about IT
Subscribe to get the latest posts sent to your email.
i got !The report couldn’t be generated, because it was empty. Adjust your filters and try again.?
That’s an error you get when your runtime dataset is empty.
This can be because the table(s) might be empty or you have applied filter(s) that result in no matches.