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

Subreports randomly are coming in blank

3 Answers 70 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Glenn
Top achievements
Rank 1
Glenn asked on 01 Nov 2013, 06:52 PM

Telerik Version: 6.1.12.820

 

 


Hello,

I have a major issue with some of the subreports coming in as white space (not a blank table).

We have a win form with 2 telerik reportviewers stacked ontop of each other.  One displays the individual mainpage + subreport combo while the other loads all the combinations of the main page + subreports (about 100 or so, totaling 350 pages (abouts), this one uses the ReportBook concept).  We do this because we need to be able to preview the reports while the large report is building since it takes anywhere from 3-20 mins.  And once it's completed we hide the single report viewer and show the one with all the reports.

All this was working fine but in the last few days it has been displaying blank subreports on both the large report and the single report, not necessarily the same subreport.

<Summary>

I have 1 main report with an empty detail section.  I have a subreport with a table in it (blank).  At runtime I basically stuff the subreports in the main report.  All this is working fine except as of lately, several subreports are coming up as white space.  I mean, you see the main pages header and footer, but where the detail is, it's all white. 

Now to take this a step further, if you save as pdf, some of the subreports are white spaces, not necessarily the same ones that are blank in the viewer.

this is basically what I do:

 

                    foreach (...)
                    {
                        var genericSubReport = new GenericSubReport(data, title);

                        Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource();

                        instanceReportSource.ReportDocument = genericSubReport;

                        //use w/o subreports defined
                        Telerik.Reporting.SubReport subReport = new Telerik.Reporting.SubReport();
                        subReport.Location = new Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(subReportDefaultLocation), Telerik.Reporting.Drawing.Unit.Inch(currentLocation));
                        subReport.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(subReportWidthSevenPointNine), Telerik.Reporting.Drawing.Unit.Inch(subReportSpacer));
                        measureReport.Items["detailSection"].Items.Add(subReport);

                        subReport.ReportSource = instanceReportSource;

                        subReportIndex++;
                        currentLocation += LOCATION;
                    }

The subreport itself, builds the table in the code behind.  We do all this becase it was either design 100+ reports or use a dynamic model.  Other thing to note is the subreports do not use the NeedDatasource but do use the ItemDataBinding.

</Summary>



3 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 06 Nov 2013, 12:18 PM
Hello Glenn,

Please try to avoid using the InstanceReportSource if the same instance is going to be reused multiple times - switch it with a TypeReportSource and pass the report by assembly qualified name. Also serialize the result report instance and preview it with the Standalone Designer of the corresponding version to verify the created report definition. Avoid using the ItemDataBinding event to position items or alter their definition, use bindings, conditional formatting or other expressions instead - for more details take a look at the Understanding Events help article.

If you need further help, we will need to review the report generation and the use of the events. Any additional details about the result from the above suggestions will be helpful.

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
Glenn
Top achievements
Rank 1
answered on 06 Nov 2013, 05:10 PM
Thanks Stef for your reply.  But after looking at what you gave me I'm more confused than when I first started.  I think it might be better if I just describe the process and maybe you can give me a demo to work with using Winforms (C#).

I have a dataset that is created from another process which contains 1..n datatables.  Each datatable is a subreport.  Since I do not know the columns ahead of time I need to generate the subreport's detail section table by adding columns, et al. 
So I thought I needed to

Create a ReportBook to hold the reports
Foreach MainReport
    Create an instance of the main report
    Foreach datatable
        create an instance of the subreport
        add subreport to main report
    Next
    Add the main report to the ReportBook
Next
Add ReportBook to the ReportViewer

The problem with the current documentation on Telrik's site is they have an example of how to do this, they have an example of how to do that, but no example of how to do this with that.  If one is there I can't find it.

Glenn
0
Stef
Telerik team
answered on 11 Nov 2013, 06:44 PM
Hello Glenn,

Please test my previous suggestions in your application and let us know the result.

Also if the purpose of the SubReport is just to show data in tabular format, try to use directly a Table item. Start by creating a sample report with several Table items in it and reuse the code to generate a separate Table item for each Table in the DataSet and add it to the report instance.

In order to provide you more accurate suggestions, we will need to check your code or a sample project illustrating it. Please remove any licensed Telerik assemblies, upload the sample project reproducing the issue and post the download link.

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.

Tags
General Discussions
Asked by
Glenn
Top achievements
Rank 1
Answers by
Stef
Telerik team
Glenn
Top achievements
Rank 1
Share this question
or