Telerik Forums
Reporting Forum
3 answers
381 views
Hello Telerik team,

in my report I have to build more than one table dynamically. I want to display one table for each item of a list and I fetch the data from another source. I've looked in the designer how a table is build that will display a list and it's content row by row for every item.

So here I have build my code in the initialization:

protected void Report_Load()
        {
            this.DataSource = this.obj;
 
            #region Generierung der Komponenten-Tabellen
            // Für jede Komponentengruppe müssen wir eine Tabelle im Report dynamisch erstellen.
            int cgid = 0; // Component Group ID
            foreach (PRODUKTKOMPONENTENGRUPPE componentGroup in this.obj.Lizenz.PRODUKTVERSION.PRODUKTKOMPONENTENGRUPPE.OrderBy(x => x.SortNo))
            {
                TextBox lComponentGroup = new TextBox() // Komponentengruppe - Überschrift
                {
                    Name = "lComponentGroup" + cgid.ToString(),
                    Location = new PointU(Unit.Cm(cgid * 2), Unit.Cm(0)), // Location anhand ID im Panel
                    Size = new SizeU(LicenseReport.MaxWidth, Unit.Cm(0.5)),
                    Value = componentGroup.Name + ":"
                };
                lComponentGroup.Style.Font.Italic = true;
                lComponentGroup.Style.BorderColor.Top = Color.Gray;
                lComponentGroup.Style.BorderStyle.Top = BorderType.Outset;
                lComponentGroup.Style.VerticalAlign = VerticalAlign.Middle;
                this.pComponentGroups.Items.Add(lComponentGroup);
 
                //// Die Tabelle für eine Komponentengruppe:
                Table tComponentGroup = new Table() // Tabelle
                {
                    Name = "tComponentGroup" + cgid.ToString(),
                    Location = new PointU(Unit.Cm(0), lComponentGroup.Location.Y + lComponentGroup.Size.Height),
                    Size = new SizeU(LicenseReport.MaxWidth, Unit.Cm(1))
                };
                tComponentGroup.Body.Columns.AddRange(new TableBody.ColumnCollection() // Spalten erstellen und Breiten setzen
                {
                    new TableBodyColumn(LicenseReport.MaxWidth / 16 * 4),
                    new TableBodyColumn(LicenseReport.MaxWidth / 16 * 7),
                    new TableBodyColumn(LicenseReport.MaxWidth / 16 * 2.5),
                    new TableBodyColumn(LicenseReport.MaxWidth / 16 * 2.5),
                }); // row width
 
                // Controls für die Spaltenköpfe erstellen und die Spaltenköpfe mit ihnen füllen:
 
                TextBox tbComponentColumnKey = new TextBox()
                {
                    Name = "tbComponentColumnKey" + cgid.ToString(),
                    Size = new SizeU(tComponentGroup.Body.Columns[0].Width, Unit.Cm(0.5)),
                    Value = "Schlüssel"
                };
                tbComponentColumnKey.Style.Font.Bold = true;
                tComponentGroup.Items.Add(tbComponentColumnKey);
                tComponentGroup.ColumnGroups.Add(new TableGroup() { ReportItem = tbComponentColumnKey });
 
                TextBox tbComponentColumnName = new TextBox()
                {
                    Name = "tbComponentColumnName" + cgid.ToString(),
                    Size = new SizeU(tComponentGroup.Body.Columns[1].Width, Unit.Cm(0.5)),
                    Value = "Name"
                };
                tbComponentColumnName.Style.Font.Bold = true;
                tComponentGroup.Items.Add(tbComponentColumnName);
                tComponentGroup.ColumnGroups.Add(new TableGroup() { ReportItem = tbComponentColumnName });
 
                TextBox tbComponentColumnUnitPrice = new TextBox()
                {
                    Name = "tbComponentColumnUnitPrice" + cgid.ToString(),
                    Size = new SizeU(tComponentGroup.Body.Columns[2].Width, Unit.Cm(0.5)),
                    Value = "Stückpreis"
                };
                tbComponentColumnUnitPrice.Style.Font.Bold = true;
                tComponentGroup.Items.Add(tbComponentColumnUnitPrice);
                tComponentGroup.ColumnGroups.Add(new TableGroup() { ReportItem = tbComponentColumnUnitPrice });
 
                TextBox tbComponentColumnTotalPrice = new TextBox()
                {
                    Name = "tbComponentColumnTotalPrice" + cgid.ToString(),
                    Size = new SizeU(tComponentGroup.Body.Columns[3].Width, Unit.Cm(0.5)),
                    Value = "Preis"
                };
                tbComponentColumnTotalPrice.Style.Font.Bold = true;
                tComponentGroup.Items.Add(tbComponentColumnTotalPrice);
                tComponentGroup.ColumnGroups.Add(new TableGroup() { ReportItem = tbComponentColumnTotalPrice });
 
 
                tComponentGroup.Body.Rows.Add(new TableBodyRow(Unit.Cm(0.5))); // Zeilen erstellen / row height
                // (Wir erstellen nur eine Reihe die dynamisch für jedes Item in die Tabelle angefügt wird)
 
                // Controls erstellen, und Zeilen mit Controls füllen:
 
                TextBox tbComponentCellKey = new TextBox()
                {
                    Name = "tbComponentCellKey" + cgid.ToString(),
                    Size = new SizeU(tComponentGroup.Body.Columns[0].Width, Unit.Cm(0.5)),
                    Value = @"=Key"
                };
                tComponentGroup.Items.Add(tbComponentCellKey);
                tComponentGroup.Body.SetCellContent(0, 0, tbComponentCellKey);
 
                TextBox tbComponentCellName = new TextBox()
                {
                    Name = "tbComponentCellName" + cgid.ToString(),
                    Size = new SizeU(tComponentGroup.Body.Columns[0].Width, Unit.Cm(0.5)),
                    Value = @"=Name"
                };
                tComponentGroup.Items.Add(tbComponentCellName);
                tComponentGroup.Body.SetCellContent(0, 0, tbComponentCellName);
 
                TextBox tbComponentCellUnitPrice = new TextBox()
                {
                    Name = "tbComponentCellUnitPrice" + cgid.ToString(),
                    Size = new SizeU(tComponentGroup.Body.Columns[0].Width, Unit.Cm(0.5)),
                    Value = @"=UnitPrice"
                };
                tComponentGroup.Items.Add(tbComponentCellUnitPrice);
                tComponentGroup.Body.SetCellContent(0, 0, tbComponentCellUnitPrice);
 
                TextBox tbComponentCellTotalPrice = new TextBox()
                {
                    Name = "tbComponentCellTotalPrice" + cgid.ToString(),
                    Size = new SizeU(tComponentGroup.Body.Columns[0].Width, Unit.Cm(0.5)),
                    Value = @"=TotalPrice"
                };
                tComponentGroup.Items.Add(tbComponentCellKey);
                tComponentGroup.Body.SetCellContent(0, 0, tbComponentCellKey);
 
                TableGroup tgComponentDetailGroup = new TableGroup() // Detailgruppe für den dynamischen Teil (notwendig)
                {
                    Name = "DetailGroup"
                };
                tgComponentDetailGroup.Groupings.Add(new Grouping(null));
                tComponentGroup.RowGroups.Add(tgComponentDetailGroup);
 
                // Zum Panel hinzufügen und Daten anbinden:
                this.pComponentGroups.Items.Add(tComponentGroup);
                tComponentGroup.DataSource = this.obj.Komponenten.Where(x => x.GroupName.Equals(componentGroup.Name)).OrderBy(x => x.SortNo);
 
                cgid++;
            }
            this.pComponentGroups.Height = Unit.Cm(cgid * 2);
            this.pComponentGroups.Style.BackgroundColor = Color.Transparent;
            #endregion
        }

I call this method on load of the report, this.obj is my source for the whole report and so on. This passes without errors and when I debugged it, everything is attached right as I want it, the question is just, will this code cause any problems?

Because even when I'm sure, after the page is loaded and the AJAX tries to get the report into the window I get this: 
The full stack trace:
[NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.]
Telerik.Reporting.Processing.Table.ForEachCell(Action`1 action) +272
Telerik.Reporting.Processing.Table.MeasureDataItemContent(IMeasureContext context, SizeRF availableClientSize) +428
Telerik.Reporting.Processing.DataItem.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +178
Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +439
Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +204
Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +146
Telerik.Reporting.Processing.LayoutElement.Measure(IMeasureContext context, SizeRF availableSize) +192
Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureChildItems(IMeasureContext context, SizeRF availableClientSize) +225
Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +86
Telerik.Reporting.Processing.Panel.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +196
Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +439
Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +204
Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +146
Telerik.Reporting.Processing.LayoutElement.Measure(IMeasureContext context, SizeRF availableSize) +192
Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureChildItems(IMeasureContext context, SizeRF availableClientSize) +225
Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +86
Telerik.Reporting.Processing.ReportSectionBase.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +190
Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +439
Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +204
Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +146
Telerik.Reporting.Processing.LayoutElement.Measure(IMeasureContext context, SizeRF availableSize) +192
Telerik.Reporting.Processing.StackLayout.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +557
Telerik.Reporting.Processing.Group.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +209
Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +439
Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +204
Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +146
Telerik.Reporting.Processing.LayoutElement.Measure(IMeasureContext context, SizeRF availableSize) +192
Telerik.Reporting.Processing.StackLayout.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +557
Telerik.Reporting.Processing.Report.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +298
Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +439
Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +204
Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +146
Telerik.Reporting.Processing.LayoutElement.Measure(IMeasureContext context, SizeRF availableSize) +192
Telerik.Reporting.Processing.SubReport.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +141
Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +439
Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +204
Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +146
Telerik.Reporting.Processing.LayoutElement.Measure(IMeasureContext context, SizeRF availableSize) +192
Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureChildItems(IMeasureContext context, SizeRF availableClientSize) +225
Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +86
Telerik.Reporting.Processing.ReportSectionBase.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +190
Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +439
Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +204
Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +146
Telerik.Reporting.Processing.LayoutElement.Measure(IMeasureContext context, SizeRF availableSize) +192
Telerik.Reporting.Processing.StackLayout.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +557
Telerik.Reporting.Processing.Group.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +209
Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +439
Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +204
Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +146
Telerik.Reporting.Processing.LayoutElement.Measure(IMeasureContext context, SizeRF availableSize) +192
Telerik.Reporting.Processing.StackLayout.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +557
Telerik.Reporting.Processing.Report.MeasureContent(IMeasureContext context, SizeRF availableClientSize) +298
Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +439
Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +204
Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeRF availableSize) +146
Telerik.Reporting.Processing.LayoutElement.Measure(IMeasureContext context, SizeRF availableSize) +192
Telerik.Reporting.Processing.LayoutElement.MeasureElement(LayoutElement elementToMeasure, IMeasureContext context) +167
Telerik.Reporting.BaseRendering.RenderingExtensionBase.MeasureReportCore(Report report, IMeasureContext measureContext) +54
Telerik.Reporting.BaseRendering.RenderingExtensionBase.MeasureReport(Report report) +134
Telerik.Reporting.BaseRendering.RenderingExtensionBase.Render(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback) +791
Telerik.Reporting.Processing.ReportProcessor.CountPages(IList`1 reports, IRenderingContext renderingContext, Hashtable deviceInfo, ExtensionInfo extensionInfo, CreateStream createStreamCallback) +1001
Telerik.Reporting.Processing.ReportProcessor.RenderCore(ExtensionInfo extensionInfo, IList`1 reports, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback) +1520
Telerik.Reporting.Processing.ReportProcessor.RenderCore(String format, IList`1 reports, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback) +155
Telerik.ReportViewer.WebForms.ReportPageOperation.RenderReport(String format, IList`1 processingReports, Hashtable deviceInfo, IRenderingContext renderingContext) +234
Telerik.ReportViewer.WebForms.ReportRenderOperation.PerformOperationOverride() +622
Telerik.ReportViewer.WebForms.ReportPageOperation.PerformOperationOverride() +214
Telerik.ReportViewer.WebForms.HandlerOperation.PerformOperation(HttpContext context, ICacheManager cacheManager) +115
Telerik.ReportViewer.WebForms.BasicHandler.ProcessRequest(HttpContext context) +438
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +913
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165


This is caused by the 2nd request on the AJAX call, I've no idea how to debug it, please can you take a look at it?
Martin
Top achievements
Rank 1
 answered on 23 Sep 2014
1 answer
566 views
So I have 2 tables within the Details section of my report.  What I want to do is filter the tables so that it only shows the Data for the Item that is currently "Active" within the group.  I'm not sure if I'm explaining it well enough so here is an example that might clarify it.  

Let's say you run a Series of Stores broken up into multiple Divisions with each division having X stores with Y Employees.  You want to show the number of Positive and Negative Feedback Results for each employee.  

You setup the Grouping like so:

Division Group
    Store Group
        Employee Group
            Details.  

Within Details you want to show two different sections.  The first section shows the Positive Feedback, and the Second section shows the Negative Feedback. 

I wasn't sure how to do this with out setting up Tables or CrossTabs so I've opted for tables.  I have setup two of them within the Details section and set the first to Filter on Positive Feedback and the second to filter on Negative Feedback.  What I also need to do is to Filter it by the Employee who is being generated within the group.  

Is this even possible with Client Side reports?  If so, can someone point me in the right Direction.  I've tried looking in the filters section, but I can't find anything that Deals with the groups specifically.  




Nasko
Telerik team
 answered on 23 Sep 2014
1 answer
754 views
Dear all,

We have a problem with Telerik Reporting:
We' re trying to create a report which can grow to multiple pages, but the header section (containing multiple data from database, currently on a crosstab) have to appear on every page of the report.

It's clear that we cannot place these header data to page header, since it cannot contain databound (from dataset) items.

But how can we achieve this functionality?

Thanks,
Peter
Stef
Telerik team
 answered on 22 Sep 2014
3 answers
213 views
Hello everybody

I'm trying to print labels using Telerik.ReportProcessor class and PrintReport() method. It's working almost perfect. But I got one problem: Everytime I try to print a label (only one), it prints two labels. If I try to print 3 labels, it prints 6. It prints always the double of the number of labels I'm trying to print. I tried to resize it to 10px height and 10px width because I thought it's too big. But that didn't help. Doesn't matter how big the label is, it always prints the double.
You can see my C# code here:

PrinterSettings printerSettings = new PrinterSettings();
printerSettings.PrinterName = @"\\bbfs\LA42";

PrintController standardPrintController = new StandardPrintController();

ReportProcessor reportProcessor = new ReportProcessor();
reportProcessor.PrintController = standardPrintController;
InstanceReportSource instanceReportSource = new InstanceReportSource();
instanceReportSource.ReportDocument = myReport;
reportProcessor.PrintReport(instanceReportSource, printerSettings);

Did anyone ever had that problem before or does anyone know the solution? I'm getting stuck on this, it's really annoying and a waste of labels :)

Hope someone can help me.

Regards,
Roman
KS
Top achievements
Rank 1
 answered on 22 Sep 2014
1 answer
134 views
I've discovered that if an XML field name has dashes in it, that Telerik reports can't read the full field name.  For example, if I have 'First-Name', the error generated says it can't find 'First'.  Is there a way around this, by chance?
Stef
Telerik team
 answered on 22 Sep 2014
3 answers
378 views
Hi Everyone,

I have a requirement to export the grid data to excel sheet(XLSX). Grid may have row details.

Which Telerik API is suitable for this requirement( Reporting APIs or any other).

And even i would like extend this export functionality to export in PDF format.

Please provide me the details to start using Telerik API's to make report generation success :)

Thanks,
Sharath
Stef
Telerik team
 answered on 22 Sep 2014
3 answers
624 views
Hi all

I am working on telerik reporting and follow the guide: http://www.telerik.com/help/reporting/html5-report-viewer-howto-custom-parameters.html.


In the telerik designer, i create data source that call store procedure with parameter (@BranchId int). I also create a Report Parameter BranchId (int)
 so i assign store procedue paramter equals the report paramter.

In java script i pass report parameter as the above tutorial, but when i run the program it just give me:  Procedure or function 'GetProductBranch' expects parameter '@BranchId', which was not supplied.

Any advice please let me know

Thanks
Phuc
Top achievements
Rank 1
 answered on 22 Sep 2014
2 answers
110 views
In which version of Telerik Reporting was deviceInfo ContentOnly key for HTML5 introduced?
Where can I find documentation to older releases?
Pawel
Top achievements
Rank 1
 answered on 19 Sep 2014
3 answers
169 views
Page breaks are currently not supported on row groups in a table. We are looking at migrating our legacy reports from MSSQL RS and we make extensive use of optional page breaks at the end of a group. Is it possible to add this feature in a future version?
Stef
Telerik team
 answered on 19 Sep 2014
3 answers
321 views
Howdy all!

So, my scenario: I have a standard form with data coming from an XML document supplied at run time.  This form has a lot of options on it, and not all of them are relevant all the time, so it's typical for not all XML nodes to be supplied.

For example, an employee can choose donate to charity as part of their paycheck.  When the XML is generated for this report, if they're not donating to the charity, it will not send over 'CharityAmount'.  With our old reporting program, if it didn't find a field, it just left the textbox blank, which is what we wanted.

However, if I put in Value property the expression '=CharityAmount', I now get a big ugly box telling me that 'The expression contains object 'CharityAmount' that is not defined in the current context'.

This is a great tool if I'm always expecting CharityAmount - but I'm not.  I tried '=ISNULL(CharityAmount,"")' as the expression, but that didn't work.  Is there a way to turn off the error messages, or at least just certain ones?  If not, is there another way of doing what I need (being flexible if something's not found) other than 'Ensure all XML nodes a report expects is supplied'?

Thanks all!
Amanda
Top achievements
Rank 1
Iron
 answered on 19 Sep 2014
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?