This is a migrated thread and some comments may be shown as answers.

Passing Error Code from a report to the RenderingResult

3 Answers 164 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
jean-Marc
Top achievements
Rank 1
jean-Marc asked on 04 Mar 2014, 07:53 AM
Hi,

I have a simple case scenario where I programatically export my report to various file format then email our report to our customer.
Now it happens that those reports contains no data and in this case we want to send a proper email informing them that their report contains no data (which is good usually because we send alerts report :) )

anyway, it sounds like a simple enough scenario though I couldn't yet place my hand onto it ...

code looks like this:
RenderingResult result = reportProcessor.RenderReport(exportFormat, telerikReport, null);
 if (result.HasErrors)
wish I could say if error == "No data" then ...else ...

any help / suggestion?
Regards
Jim
PS: version used Q1 2011 SP1 (5.0.11.510)...I know time to upgrade right ;)

3 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 06 Mar 2014, 07:13 PM
Hello Jean-Marc,

Telerik Reporting provides a mechanism to handle such scenarios where no data comes from the data source. This is done via the NoDataMessage property of a data item. For more information please follow the How to: Set a No Data Message help article.

However, if the data source in question is set to the Report.DataSource then you need to use a different approach. Add a TextBox item within a Report Header section, then set the textbox value to "No Data". To hide the Report Header section when the data source returns data, add a Binding with Property Path - Parent.Visible and Expression - =Count(1) = 0.

Regards,
Nasko
Telerik

DevCraft Q1'14 is here! Join the free online conference to see how this release solves your top-5 .NET challenges. Reserve your seat now!

0
jean-Marc
Top achievements
Rank 1
answered on 11 Apr 2014, 07:35 AM
Hi Nasko,
thanks your answer and sorry i let this one pending for so long, just pulled away on some other projects as always :)

I cannot seem to find this property NoDataMessage in the report, are you sure this feature is available for my version (version used Q1 2011 SP1 (5.0.11.510))?

but anyway if i well understand both technique you describe will display a specific message in the report itself, right? If so this is not exactly what I am trying to do, in fact I want to pass this information outside the telerik report engine.

RenderingResult result = reportProcessor.RenderReport(exportFormat, telerikReport, null);

 if (result.HasErrors)

wish I could say if error == "No data" then ...else ...

does it make sense?
Regards
Jim
0
Peter
Telerik team
answered on 15 Apr 2014, 04:01 PM
Hello Jim,

As you guess both approaches suggested by my colleague will change the no data items rendering behavior. Generally one report can have multiple data items that use multiple datasource components and some of them may have data but other not. Thus providing general report wide no data rendering information from the data processing engine is not available.

In order to handle your requirement you will have to provide and check the data manually based on your data environment prior invoking the report processor.

Regards,
Peter
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
jean-Marc
Top achievements
Rank 1
Answers by
Nasko
Telerik team
jean-Marc
Top achievements
Rank 1
Peter
Telerik team
Share this question
or