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

Avoid empty reports in a reportbook

2 Answers 82 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 08 Mar 2012, 02:50 PM
I have created a reportbook which shows sales information at the highest level of a client. If a client-structure contains several departments, a sales report for each department is created, and will be added to the reportbook.

The structure of a client is stored outside telerik, in an AD-database. The parameters are passed to the report in the code-behind (department is item in a list of departments items):

foreach (var item in items)
{
    RptAnalyseOmzetTotaal rptAnalyseOmzetTotaal = new RptAnalyseOmzetTotaal();
    rptAnalyseOmzetTotaal.ReportParameters["customer"].Value = item.TrimStart('0');
    rptAnalyseOmzetTotaal.ReportParameters["year"].Value = year;
    rptAnalyseOmzetTotaal.ReportParameters["periodFrom"].Value = periodFrom;
    rptAnalyseOmzetTotaal.ReportParameters["periodTo"].Value = periodTo;
    reportBook.Reports.Add(rptAnalyseOmzetTotaal);
}

The problem is if a department doesn't have sales for the asked period, an empty report is added to the reportbook.
I need to do a check if a department contains data. Does the report-class rptAnalyseOmzetTotaal have a method to check if it contains data for the given parameters?

I'm using Reporting Q1 2012 in a Umbraco Portal.

2 Answers, 1 is accepted

Sort by
0
Chris Gillies
Top achievements
Rank 1
answered on 09 Mar 2012, 08:44 AM
No, there is no method to check for that. You can check whether there is a detail record, which would mean that your parameters have value, and if there is no detail record, then you do not add that report to the report book collection.

Cheers!
0
Peter
Top achievements
Rank 1
answered on 09 Mar 2012, 09:04 AM
the parameters are set by the user, so they are always filled.

I Think i have to write a method, which querys the BI-database. If there is a null return, the the report must be skipped.
The drawback of this option is the extra load of querying.

If there is a better solution, let me know!
Tags
General Discussions
Asked by
Peter
Top achievements
Rank 1
Answers by
Chris Gillies
Top achievements
Rank 1
Peter
Top achievements
Rank 1
Share this question
or