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

How to display "no data" message in report?

10 Answers 433 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Laura Middleton
Top achievements
Rank 1
Laura Middleton asked on 11 May 2010, 09:36 PM
I created a report containing a single crosstab.  Is it possible to show a "no data exists" message either inside the empty crosstab or in a textbox elsewhere in the report if the query returns no data?

I'm very familiar with Microsoft Reporting Services where you can set a textbox's visbility based on whether or not a dataset is empty. That textbox would contain the "no data exists" message.  Can I do something like this or display a message right inside the crosstab? 

Thanks for your help.

10 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 13 May 2010, 01:21 PM
Hello Laura,

You can achieve the same effect in Telerik Reporting by using Conditional Formatting. Another approach is to handle the ItemDataBound event of the Crosstab report item to check programmatically whether the current Crosstab contains no data, set its Visible property to false in such case or alter the visibility of the "additional textbox" that shows the "no data" message.

Hope this helps.

Sincerely yours,
Steve
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Tim
Top achievements
Rank 1
answered on 11 Jan 2011, 06:44 AM
On the ItemDataBound event you can grab a reference to the control being databound (such as a table) and easily make it invisible, but is there a way to reference another control (such as a textbox), based on the reference to the table? For example, if the table had a 'tag' property which held the name of its related textbox, or even if you could grab the textbox by a string manipulation on the table name (like replace 'tbl' with 'txt', so that 'tblProducts' would become 'txtProducts' and you could then reference 'txtProducts' by its string name.

With reports, there doesn't seem to be any way to iterate through the controls on the report, or the datasources, or to reference a control by a text ID ( for example 'this["txtMessage"]', or 'this.controls["txtMessage"]' ). Nor is there any "No Data Template" for the Lists/Tables, so unless you create a switch/case statement based on the name of the table, you can't change other controls by using a generic helper function.

I want to have a global helper function for reports that is run on every table databound event (I have multiple databound tables on each report) and shows or hides the tables based on the row count, then shows or hides a textbox related to each table.
0
Nandita
Top achievements
Rank 1
answered on 22 Mar 2011, 11:24 AM
Yes that's ok if you want to display that thing on the report itself. What if i want to display a message on the silverlight UI.

similarly how can i transfer the error from the reportview to the silverlight application?
0
Massimiliano Bassili
Top achievements
Rank 1
answered on 22 Mar 2011, 01:27 PM
Nandita, the error handling of the report is for your eyes only i.e. only for the developer to see, and the error should never surface to the end user. This means - make sure all errors are handled accordingly, so no errors reach the users.

Cheers!
0
Nandita
Top achievements
Rank 1
answered on 22 Mar 2011, 01:54 PM
But how do i make sure.. 

should i use try with empty catch block in the needDataSource event?

I don't think it is the correct view. How do i tell the user that the SQL server is down or the network is down or there is a time out due to congestion in the network.

We are handling every error to display in the RadWindow.Alert. for the end users.

I was showing this demo when suddently this error came which is in the attached file. Had there been some fault contract or something attached to your report service, we would have captured it and this won't have happened.

Please give some solution.
0
Rajashree
Top achievements
Rank 1
answered on 31 Jan 2014, 04:59 AM
Can you show how to implement this programmatically?? What condition should be placed to checkif data it rturned or not. I have used Items.Count in condition for table item but its not working.
0
Stef
Telerik team
answered on 04 Feb 2014, 01:31 PM
Hi,

@Rajashree: You can use the Crosstab/Table/List item's NoDataMessage and NoDataStyle properties to set a message, when there is no data.

About error handling in reports, you can use the Report.Error event to catch exceptions, cancel the further processing and throw your custom exception that will be displayed in the viewer, or perform other custom error logging and handling logic.

Regards,
Stef
Telerik

New HTML5/JS REPORT VIEWER with MOBILE AND TOUCH SUPPORT available in Telerik Reporting Q3 2013! Get the new Reporting version from your account or download a trial.

0
Rajashree
Top achievements
Rank 1
answered on 07 Feb 2014, 09:50 AM
Well. I had done that. But nothing happened. My table item was not seen but even No Data Message was not seen to. I had even provided appropriate style.
0
Nasko
Telerik team
answered on 11 Feb 2014, 05:12 PM
Hello Rajashree,

The described issue is not reproducible at our end. We tested our Crosstab/ProductSales project by setting the Crosstab.NoDataMessage and making its data source to has zero records.

Thus, it would be of great help for us if you can open a support ticket, where you can zip and attach a sample report definition exhibiting the described issue. Once we review it, we would be able to provide you with more information.

Regards,
Nasko
Telerik

New HTML5/JS REPORT VIEWER with MOBILE AND TOUCH SUPPORT available in Telerik Reporting Q3 2013! Get the new Reporting version from your account or download a trial.

0
Rajashree
Top achievements
Rank 1
answered on 12 Feb 2014, 05:53 AM
Sorry for the inconvinence. But the property worked.
Tags
General Discussions
Asked by
Laura Middleton
Top achievements
Rank 1
Answers by
Steve
Telerik team
Tim
Top achievements
Rank 1
Nandita
Top achievements
Rank 1
Massimiliano Bassili
Top achievements
Rank 1
Rajashree
Top achievements
Rank 1
Stef
Telerik team
Nasko
Telerik team
Share this question
or