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

Conditionally display message if no results found

3 Answers 235 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jordan
Top achievements
Rank 1
Jordan asked on 02 Dec 2011, 04:13 PM
Hi,

I am currently evaluating Telerik reporting.  We will be generating reports that are both used in an MVC webapp and emailed to people as part of overnight batch processes.

I want to conditionally display a message in the report if no results have been found. I have looked at this thread but this doesn't suit my needs. Are there any other ways of doing this? eg by counting the number of records in the report and displaying a message if the count == 0?

many thanks,
Jordan.

3 Answers, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 07 Dec 2011, 10:15 AM
Hello Jordan,

 

Currently there is no out of the box solution to show a message when there is no data. We have this feature logged in our features list and we will introduce this option with a subsequent version of Telerik Reporting.

In the meantime there is a workaround you can use instead. Just add a TextBox item within a Report Header section. Then set the textbox value to "No Data Found". To hide the Report Header section when the datasource returns data, add the following Binding to the textbox item:
Property Path
 Expression 
 Parent.Visible
 =Count(1) = 0

To hide the Detail section when there are no records found you have to add the following Binding:
Property Path
 Expression 
 Parent.Visible
 =Count(1) > 0
All the best,
Peter
the Telerik team

Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

0
Jordan
Top achievements
Rank 1
answered on 07 Dec 2011, 12:03 PM
Hi Peter,

Many thanks for the reply.

Just out of interest, why do you pass "1" to the Count() function? Is that a shortcut/alias to getting the result set?

cheers,
Jordan.
0
Steve
Telerik team
answered on 07 Dec 2011, 01:56 PM
Hello Jordan,

Yes, count of constant gives you the whole result set.

Best wishes,
Steve
the Telerik team

Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

Tags
General Discussions
Asked by
Jordan
Top achievements
Rank 1
Answers by
Peter
Telerik team
Jordan
Top achievements
Rank 1
Steve
Telerik team
Share this question
or