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

Combine paramertized reports in Report Book problem

5 Answers 218 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
VanirDev
Top achievements
Rank 1
VanirDev asked on 12 Jun 2009, 10:57 PM
Hi,
Lets suppose that Region consists of multiple Areas
I have two reports: RegionReport and AreaReport that I would like to combine into one report book.
RegionReport takes one non-mergable parameter, integer - regionId, that I use in NeedDataSoruce in my db query.

In my report book I am trying to achieve the following:
RegionReport - ie California
AreaReport - Sacramento
AreaReport - LA
RegionReport - ie Texas
AreaReport - Dallas
AreaReport - Huston

To achieve this I construct the report book in the following way:
reportBook = new ReportBook(); 
for (int i = 0; i < regionList.Count; i++) 
    RegionReport regionReport = new RegionReport(); 
    regionReport.ReportParameters["RegionId"].Value = regionList[j]; 
    reportBook.Reports.Add(regionReport); 
    for (int j = 0; j < areaList.Count; j++) 
    { 
        AreaReport areaReport = new AreaReport(); 
        areaReport.ReportParameters["AreaId"].Value = areaList[j]; 
        reportBook.Reports.Add(areaReport); 
    } 

When processing the reports, in NeedDataSource event, the value for the RegionId paramenter in the following code is always of the last value added. In other words it is not preserved from one RegionReport to another.
private void RegionReport_NeedDataSource(object sender, EventArgs e) 
    Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender; 
    //If I had two RegionReport reports added to the book, RegionId parameter's value would be always of the last one added. 
    int paramConvert.ToInt16(this.ReportParameters["RegionId"].Value); 
    ... 
 

What is the proper way of preserving individual reports paramenters' values in a report book ?
Thank you
Pawel Mozdzen

5 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 15 Jun 2009, 02:29 PM
Hello Pawel,

I was not able to replicate the problematic behavior you've described. Please find attached a sample web application that mimics your code and works as expected. Give it a spin and let us know if further help is needed.

Best wishes,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
VanirDev
Top achievements
Rank 1
answered on 15 Jun 2009, 08:36 PM
Thank you for your response.
I tracked my problem down to Session State setting in web.config. We use StateServer out-of-process session management.
I found a KB article "Design Considerations for Out-Proc Session State" that describes the problem. Unfortunately it provides a solution for a single report only, not a report book.
I modified the example attached to that article accordingly, and still, cannot get my parameters preserved.

Please advise o possible workaround.

Thank you,
Pawel Mozdzen
0
Steve
Telerik team
answered on 16 Jun 2009, 01:16 PM
Hi Pawel,

Indeed you are correct and the problem exists in out proc session mode. We consider this a problem on our end and I have logged it in our bug tracking system. For the time being the only possible workaround would be to set different parameter name on each loop, so that all are gathered on deserialization of the report.

Please excuse us for the temporary inconvenience. Your Telerik points have been updated for bringing this to our attention.

All the best,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
VanirDev
Top achievements
Rank 1
answered on 16 Jun 2009, 06:03 PM
Hi Steve,
I am afraid your workaround is not going to work.
In out proc session mode the report class gets instantiated several times. Here is an example:
ReportBook reportBook = this.ReportViewer1.Report as ReportBook; 
string[] regionList = new string[4] { "2008", "2009", "2010", "2011" }; 
 
for (int i = 0; i < regionList.Length; i++) 
    Report1 report = new Report1(); 
    report.ReportParameters["Year"].Value = regionList[i]; 
    ... 
    reportBook.Reports.Add(report); 
 
The Report1 class gets initialized, as it should, at line 6 but also when I go through reports in report viewer. Before first page is displayed Report1 gets initialized 4 times (number of projects in the report book) and on any subsequent page, when Next Page button is clicked, it gets initialized all four times.
Any attempt to modify or add a parameter will not work.
Any other ideas on how to manage parameters are welcomed.

How can I track this issue's bug status?

Thank you,
Pawel Mozdzen
0
Steve
Telerik team
answered on 17 Jun 2009, 07:16 AM
Hello Pawel,

The issue has already been addressed by our developers and would be part of the Q2 release scheduled for the end of the month. Please let us know if two weeks are ok by you and whether you can wait for the fix, otherwise we would have to think of some ugly "hacks" to get this working.
If it is ok, please use InProc session for developing and rest assured this would be working as expected for out of proc session when the Q2 release is out.

Greetings,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
General Discussions
Asked by
VanirDev
Top achievements
Rank 1
Answers by
Steve
Telerik team
VanirDev
Top achievements
Rank 1
Share this question
or