web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

How to throw error if 0 data extracted while generating SSRS report?

(0) ShareShare
ReportReport
Posted on by 672

Hi Experts,

I need to throw error "There is no data to be output " while generating SSRS report if there is 0 data extraction instead of blank report generation.

As of now I have passed a boolean variable as true under loop condition if there is data extracted and else the boolean will be false. After loop I have put if condition where error is thrown when boolean value is false

But in this case error is thrown but blank report is also printing. But I don't want to generate the blank report only info log should come.

Note: Report is called through controller class.

Please guide me to achieve this functionality.

I have the same question (0)
  • Martin Dráb Profile Picture
    239,067 Most Valuable Professional on at

    I'm not sure, but I think the report gets printed because your RDP class (you forgot to mention that, but I'm assuming that you're talking about code in an RDP class) gets called only when the report is being generated. A solution may be using pre-processing. Then the data provider is executed before the report itself.

  • D365FO Avatar Profile Picture
    672 on at

    Yes Martin,

    If I'm getting to correct by pre-processing are you talking about extending the DP class with SrsReportDataProviderPreProcessTempDB? If yes so I'm doing that already.

    How can I use pre-processing? Can you please elaborate it.

  • Martin Dráb Profile Picture
    239,067 Most Valuable Professional on at

    There are more options than just SrsReportDataProviderPreProcessTempDB, but yes, you can use this one.

    But ask yourself whether you really want your single form to behave differently than all the other reports in F&O. It's recommended to keep user experience consistent.

  • D365FO Avatar Profile Picture
    672 on at

    What are the other ways??

    Is there is any standard method to achieve this functionality?

  • Verified answer
    Martin Dráb Profile Picture
    239,067 Most Valuable Professional on at

    No, there is no standard way, because that's not what the standard logic does.

    But if you want to do it anyway and putting the check to your RDP class doesn't work even if you use pre-processing, then consider checking the data already in the controller. Whether it's feasible depends on how difficult is to obtain the data.

  • Verified answer
    Sheikh Sohail Profile Picture
    6,125 on at

    Hi

    If you are using the controller class then you can validate before calling the report operations that either record exists then call the report or not.

    But Once the report is called, then it will be print either with data or empty.

  • Suggested answer
    D365FO Avatar Profile Picture
    672 on at

    Thanks Martin and Sohail,

    I have used Validate() of contract class and checked if data exist for the required condition or not. If not validation will failed and throw the error in the parameter screen itself..

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 692

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 454 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 311 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans