Telerik Forums
Reporting Forum
4 answers
161 views
I have a report that handles its datasource internally.  The layout requires three sub-reports and rather than have it fire three database calls for every item on the report I've written a stored procedure which returns four data tables (primary report data, and three tables for the sub-reports).  As each of the customers is displayed, I used the GroupHeader ItemDataBinding event to filter the sub-report tables and dynamically set those datasource values to the filtered data.

This worked great in 2012 Q1, but after updating to Q3 the GroupHeader ItemDataBinding event no longer fires.  As a result, my sub-reports are completely blank.

What do I need to do to resolve this issue?  Below is my code:

public string ConnectionString { get; set; }
 
private void Rpt_CustomerAccountsReport_NeedDataSource(object sender, EventArgs e)
{
    try
    {
        if (Report.ReportParameters["MarketListID"].Value == null
            && Report.ReportParameters["BranchID"].Value == null
            && Report.ReportParameters["CustomerGroupID"].Value == null
            && Report.ReportParameters["CustomerID"].Value == null)
        {
            ErrorMsg("Error!  This report cannot be run without parameters.  Please select a Branch, Marketing list or Customer group.");
        }
        else
        {
            SqlData data = new SqlData(ConnectionString);
            // Shared getdataset function
            dsMain = data.GetDataSet("spRpt_CustomerAccountsReport", CommandType.StoredProcedure,
                                     "@EmployeeUserID", Report.ReportParameters["EmployeeUserID"].Value,
                                     "@MarketListID", Report.ReportParameters["MarketListID"].Value,
                                     "@CustomerID", Report.ReportParameters["CustomerID"].Value,
                                     "@BranchID", Report.ReportParameters["BranchID"].Value,
                                     "@CustomerGroupID", Report.ReportParameters["CustomerGroupID"].Value,
                                     "@EmployeeID", Report.ReportParameters["EmployeeID"].Value);
 
            // ** Moving the max record limit to the stored procedure so we can change / make it user configurable without a re-compile
            if (dsMain.Tables[0].Rows.Count > 40000)
            {
                ErrorMsg("Over 40,000 results were returned.  The report cannot render.  Please select more specific criteria.");
            }
            else
            {
                Report.DataSource = dsMain.Tables[0];
            }
 
        } // They provided parameters
    }
    catch (Exception ex)
    {
        ErrorMsg(ex.Message);
    }
}
 
private void GroupHeaderArea1_ItemDataBinding(object sender, EventArgs e)
{
    try
    {
        // Get the section
        Telerik.Reporting.Processing.GroupSection section = (sender as Telerik.Reporting.Processing.GroupSection);
 
        if (section != null)
        {
            // Get the customer ID for this section
            object id = section.DataObject["CustomerID"];
 
            if (id != null)
            {
                int CustID = (int)id;
 
                // Filter out sub-report data
                DataRow[] drContacts = dsMain.Tables[1].Select("CustomerID=" + CustID.ToString());
                DataRow[] drCrossSell = dsMain.Tables[2].Select("CustomerID=" + CustID.ToString());
                DataRow[] drAccounts = dsMain.Tables[3].Select("CustomerID=" + CustID.ToString());
 
                Rpt_CustomerAccountsReportAccountSummary rptAcct = new Rpt_CustomerAccountsReportAccountSummary();
                Rpt_CustomerAccountsReportContacts rptContact = new Rpt_CustomerAccountsReportContacts();
                Rpt_CustomerAccountsReportCrossSell rptCrossSell = new Rpt_CustomerAccountsReportCrossSell();
 
                rptAcct.DataSource = drAccounts;
                rptContact.DataSource = drContacts;
                rptCrossSell.DataSource = drCrossSell;
 
                srContacts.ReportSource = rptContact;
                srCrossSell.ReportSource = rptCrossSell;
                srAccountSummary.ReportSource = rptAcct;

            }
        }
    }
    catch (Exception ex)
    {
        ErrorMsg(ex.Message);
    }
}
Nick
Top achievements
Rank 1
 answered on 10 May 2013
1 answer
172 views
Is it possible to have a headless application render reports locally (no server) and print directly? I need something to watch for events and then print.

Thanks
Peter
Telerik team
 answered on 10 May 2013
1 answer
57 views
Dear all,

I just want to ask a question about telerik reporting q1 2013. I'm going to render a Pie Chart using new feature Graph -> Pie Chart
the question is how can i change the Start Angle (usually existed in old version) of the pie chart in the new version?

Thanks very much.
Elian
Telerik team
 answered on 10 May 2013
1 answer
834 views
Hi,
I am using Telerik.Reporting.dll (version 5.1.11.928) and Telerik.ReportViewer.WinForms.dll (version 5.1.11.928) in Q2 Reporting 2011.

I have a column which calculates difference in minutes and I want to show them meaningful in my Telerik report.
Here is my column: sum(cast(datediff(second, IEC.CREATE_DATE, IEC.STATUS_DATE) as float) / 60) TotalSentMinutes

Here is some example values for this column: 
TotalSentMinutes
----------------------
2,15
0
1,36666666666667
92,1166666666667
902,383333333333 ... etc.

So, I want to show these values meaningfully by using Formatting in Textbox's value field. I wrote a method to show them formatted.

private string FormatMinutes(string number2)
        {
            if (number2 == "0")
                return "";

            int number = int.Parse(number2);
            string day = string.Empty;
            string hour = string.Empty;
            string minutes = string.Empty;
            string formatted = string.Empty;

            if (number >= 1440)
                day = (number / 1440).ToString();
            if (((number % 1440) / 60) > 0)
                hour = ((number % 1440) / 60).ToString();
            if ((number % 60) > 0)
                minutes = (number % 60).ToString();
            if (day != string.Empty)
                formatted += day + " day, ";
            if (hour != string.Empty)
                formatted += hour + " hour, ";
            if (minutes != string.Empty)
                formatted += minutes + " minutes";

            return formatted;
        }

I called this method in Textbox's value field like this: = IIf(Fields.SentCount = 0, 0, FormatMinutes(Fields.TotalSentMinutes))

However, I am getting error while formatting. Is it a syntax problem? Method calling problem? or should I substr values to get rid of commas in double values? How can I solve this problem?
Any suggestions?
Best,
Cihad
Stef
Telerik team
 answered on 10 May 2013
1 answer
164 views
I have run into an issue getting the group header to display the way I need it to.  Here is my scenario:  In my subreport, I have a detail section, which is where the repeating records display.  I have a group header that I need to display under 2 different circumstances - (1) if a certain field value in my detail section changes and (2) at the top of all subsequent pages while the detail records are printing. 

I have #1 working - Where I bind the data to my view model, I check to see if the field value changed from the last record.  I then send in a true or false flag to the constructor of the subreport and set headerSection1.Visible = true.  Problem is, this seems to override the GroupHeaderSection1's PrintOnEveryPage property that I have set to true. We really need that group header to display at the top of each page, as well as each time a specific field value changes.
Elian
Telerik team
 answered on 10 May 2013
2 answers
317 views
I am a Tererik Report User, I have a appliaction with Fix Linespace  multiLine Text  Layout  in  My  Report for Print , I try to use textbox Or HtmlText,But I found No Way I Can do it; Please Give me  some  guidance, How i can realize. If  possible ,please give me a example,thanks!
wen
Top achievements
Rank 1
 answered on 10 May 2013
1 answer
212 views
Is it possible to do this?  What is the easiest way to do this?
Peter
Telerik team
 answered on 09 May 2013
3 answers
672 views
I am building a report with quite a few tables in it. Based on the data used to populate the report, I need to be able to show or hide the header row of the tables at runtime. How can this be achieved?
Elian
Telerik team
 answered on 09 May 2013
1 answer
60 views
Hi
Is the ChartMarkedZone supported in the ASP.NET Ajax HTML5 Charts?
Thanks
Danail Vasilev
Telerik team
 answered on 09 May 2013
1 answer
476 views
My report layout is attached
I need to have this in a4 sheet

Section 1 - Constant Height (Bottom of A4)
Section 2 - It will vary its height according to list of data (Above section 1)
Section 3 - Picture should occupy remaining A4 page sheet (Remaining part of the paper)

What is did was
Section 1 is docked bottom
Section 2 is docked bottom (above section 1)
Section 3 is docked fill

Attached my output

When my Section 2 is bigger then details are showed by generating the second page
I need to fit all in a single page by reducing the picture size(section 3)


Is there any way to get the size of the table while setting the size of the picture.
private void InitializeComponent()
        {
            Telerik.Reporting.TableGroup tableGroup1 = new Telerik.Reporting.TableGroup();
            Telerik.Reporting.TableGroup tableGroup2 = new Telerik.Reporting.TableGroup();
            Telerik.Reporting.TableGroup tableGroup3 = new Telerik.Reporting.TableGroup();
            Telerik.Reporting.TableGroup tableGroup4 = new Telerik.Reporting.TableGroup();
            Telerik.Reporting.Drawing.TextWatermark textWatermark1 = new Telerik.Reporting.Drawing.TextWatermark();
            Telerik.Reporting.Drawing.StyleRule styleRule1 = new Telerik.Reporting.Drawing.StyleRule();
            this.textBox1 = new Telerik.Reporting.TextBox();
            this.textBox3 = new Telerik.Reporting.TextBox();
            this.textBox4 = new Telerik.Reporting.TextBox();
            this.pageHeaderSection1 = new Telerik.Reporting.PageHeaderSection();
            this.detail = new Telerik.Reporting.DetailSection();
            this.panel11 = new Telerik.Reporting.Panel();
            this.pictureBox1 = new Telerik.Reporting.PictureBox();
            this.table1 = new Telerik.Reporting.Table();
            this.textBox5 = new Telerik.Reporting.TextBox();
            this.textBox6 = new Telerik.Reporting.TextBox();
            this.textBox7 = new Telerik.Reporting.TextBox();
            this.pageFooterSection1 = new Telerik.Reporting.PageFooterSection();
            this.objectDataSource1 = new Telerik.Reporting.ObjectDataSource();
            ((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
            //
            // textBox1
            //
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(0.79998695850372314D), Telerik.Reporting.Drawing.Unit.Inch(0.29996046423912048D));
            this.textBox1.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid;
            this.textBox1.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;
            //
            // textBox3
            //
            this.textBox3.Name = "textBox3";
            this.textBox3.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(0.79998695850372314D), Telerik.Reporting.Drawing.Unit.Inch(0.29996046423912048D));
            this.textBox3.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid;
            this.textBox3.Style.BorderStyle.Left = Telerik.Reporting.Drawing.BorderType.None;
            this.textBox3.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;
            //
            // textBox4
            //
            this.textBox4.Name = "textBox4";
            this.textBox4.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(0.79998695850372314D), Telerik.Reporting.Drawing.Unit.Inch(0.29996046423912048D));
            this.textBox4.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid;
            this.textBox4.Style.BorderStyle.Left = Telerik.Reporting.Drawing.BorderType.None;
            this.textBox4.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;
            //
            // pageHeaderSection1
            //
            this.pageHeaderSection1.Height = Telerik.Reporting.Drawing.Unit.Inch(0.30000004172325134D);
            this.pageHeaderSection1.Name = "pageHeaderSection1";
            //
            // detail
            //
            this.detail.Height = Telerik.Reporting.Drawing.Unit.Inch(8.99375057220459D);
            this.detail.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
            this.panel11,
            this.pictureBox1,
            this.table1});
            this.detail.Name = "detail";
            this.detail.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Inset;
            //
            // panel11
            //
            this.panel11.Bindings.Add(new Telerik.Reporting.Binding("Location", "= Rexroth.Hydraulics.PumpsAndMotors.CalculationPrograms.Leist.Views.Report11.RepositionPanelFactor(Fields.ObjData.Count, ReportItem)"));
            this.panel11.Docking = Telerik.Reporting.DockingStyle.Bottom;
            this.panel11.Location = new Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(0D), Telerik.Reporting.Drawing.Unit.Inch(7.8937501907348633D));
            this.panel11.Name = "panel11";
            this.panel11.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(6.2677168846130371D), Telerik.Reporting.Drawing.Unit.Inch(1.1000001430511475D));
            this.panel11.Style.BackgroundColor = System.Drawing.Color.Silver;
            this.panel11.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Inset;           
            //
            // table1
            //
            //this.table1.Anchoring = Telerik.Reporting.AnchoringStyles.Top;
            this.table1.Docking = Telerik.Reporting.DockingStyle.Fill;
            this.table1.Bindings.Add(new Telerik.Reporting.Binding("DataSource", "=Fields.ObjData"));
            this.table1.Bindings.Add(new Telerik.Reporting.Binding("Location", "= Rexroth.Hydraulics.PumpsAndMotors.CalculationPrograms.Leist.Views.Report11.RepositionTableFactor(Fields.ObjData.Count,ReportItem)"));
            this.table1.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(Telerik.Reporting.Drawing.Unit.Inch(0.79998701810836792D)));
            this.table1.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(Telerik.Reporting.Drawing.Unit.Inch(0.79998701810836792D)));
            this.table1.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(Telerik.Reporting.Drawing.Unit.Inch(0.79998701810836792D)));
            this.table1.Body.Rows.Add(new Telerik.Reporting.TableBodyRow(Telerik.Reporting.Drawing.Unit.Inch(0.29996046423912048D)));
            this.table1.Body.SetCellContent(0, 0, this.textBox5);
            this.table1.Body.SetCellContent(0, 1, this.textBox6);
            this.table1.Body.SetCellContent(0, 2, this.textBox7);
            tableGroup1.ReportItem = this.textBox1;
            tableGroup2.ReportItem = this.textBox3;
            tableGroup3.ReportItem = this.textBox4;
            this.table1.ColumnGroups.Add(tableGroup1);
            this.table1.ColumnGroups.Add(tableGroup2);
            this.table1.ColumnGroups.Add(tableGroup3);
            this.table1.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
            this.textBox5,
            this.textBox6,
            this.textBox7,
            this.textBox1,
            this.textBox3,
            this.textBox4});
            this.table1.Location = new Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(0.067756019532680511D), Telerik.Reporting.Drawing.Unit.Inch(7.2937507629394531D));
            this.table1.Name = "table1";
            tableGroup4.Groupings.Add(new Telerik.Reporting.Grouping(null));
            tableGroup4.Name = "DetailGroup";
            this.table1.RowGroups.Add(tableGroup4);
            this.table1.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(2.39996075630188D), Telerik.Reporting.Drawing.Unit.Inch(0.599920928478241D));
            this.table1.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid;
            //
            // pictureBox1
            //
            this.pictureBox1.Docking = Telerik.Reporting.DockingStyle.Top;
            this.pictureBox1.Bindings.Add(new Telerik.Reporting.Binding("Size", "= Rexroth.Hydraulics.PumpsAndMotors.CalculationPrograms.Leist.Views.Report11.ResizePictureFactor(Fields.ObjData.Count,ReportItem)"));
            this.pictureBox1.Bindings.Add(new Telerik.Reporting.Binding("Value", "=Fields.MyImage"));
            //this.pictureBox1.Bindings.Add(new Telerik.Reporting.Binding("Location", "= Rexroth.Hydraulics.PumpsAndMotors.CalculationPrograms.Leist.Views.Report11.RepositionPictureFactor(Fields.ObjData.Count,ReportItem)"));
            this.pictureBox1.Location = new Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(0.0067756019532680511D), Telerik.Reporting.Drawing.Unit.Inch(3.9418537198798731E-05D));
            this.pictureBox1.MimeType = "";
            this.pictureBox1.Name = "pictureBox1";
            this.pictureBox1.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(6.1999607086181641D), Telerik.Reporting.Drawing.Unit.Inch(7.1999607086181641D));
            this.pictureBox1.Sizing = Telerik.Reporting.Drawing.ImageSizeMode.Stretch;
            this.pictureBox1.Style.BorderColor.Default = System.Drawing.Color.Maroon;
            this.pictureBox1.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid;
            this.pictureBox1.Style.BorderWidth.Default = Telerik.Reporting.Drawing.Unit.Point(1D);
            this.pictureBox1.Value = "=Fields.MyImage";
            //
            // textBox5
            //
            this.textBox5.Name = "textBox5";
            this.textBox5.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(0.79998695850372314D), Telerik.Reporting.Drawing.Unit.Inch(0.29996046423912048D));
            this.textBox5.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.Solid;
            this.textBox5.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;
            this.textBox5.Value = "=Fields.Speed";
            //
            // textBox6
            //
            this.textBox6.Name = "textBox6";
            this.textBox6.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(0.79998695850372314D), Telerik.Reporting.Drawing.Unit.Inch(0.29996046423912048D));
            this.textBox6.Style.BorderStyle.Bottom = Telerik.Reporting.Drawing.BorderType.Solid;
            this.textBox6.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.None;
            this.textBox6.Style.BorderStyle.Right = Telerik.Reporting.Drawing.BorderType.Solid;
            this.textBox6.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;
            this.textBox6.Value = "=Fields.Power";
            //
            // textBox7
            //
            this.textBox7.Name = "textBox7";
            this.textBox7.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(0.79998695850372314D), Telerik.Reporting.Drawing.Unit.Inch(0.29996046423912048D));
            this.textBox7.Style.BorderStyle.Bottom = Telerik.Reporting.Drawing.BorderType.Solid;
            this.textBox7.Style.BorderStyle.Default = Telerik.Reporting.Drawing.BorderType.None;
            this.textBox7.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;
            this.textBox7.Value = "=Fields.Torque";
            //
            // pageFooterSection1
            //
            this.pageFooterSection1.Height = Telerik.Reporting.Drawing.Unit.Inch(0.2999996542930603D);
            this.pageFooterSection1.Name = "pageFooterSection1";
            //
            // objectDataSource1
            //
            this.objectDataSource1.DataSource = typeof(Reports.MyObjects);
            this.objectDataSource1.Name = "objectDataSource1";
            //
            // Report1
            //
            this.DataSource = this.objectDataSource1;
            this.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
            this.pageHeaderSection1,
            this.detail,
            this.pageFooterSection1});
            this.Name = "Report11";
            this.PageSettings.Landscape = false;
            this.PageSettings.Margins = new Telerik.Reporting.Drawing.MarginsU(Telerik.Reporting.Drawing.Unit.Inch(1D), Telerik.Reporting.Drawing.Unit.Inch(1D), Telerik.Reporting.Drawing.Unit.Inch(1D), Telerik.Reporting.Drawing.Unit.Inch(0D));
            this.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.A4;
            textWatermark1.Text = "Approved";
            this.PageSettings.Watermarks.Add(textWatermark1);
            this.Style.BackgroundColor = System.Drawing.Color.White;
            styleRule1.Selectors.AddRange(new Telerik.Reporting.Drawing.ISelector[] {
            new Telerik.Reporting.Drawing.TypeSelector(typeof(Telerik.Reporting.TextItemBase)),
            new Telerik.Reporting.Drawing.TypeSelector(typeof(Telerik.Reporting.HtmlTextBox))});
            styleRule1.Style.Padding.Left = Telerik.Reporting.Drawing.Unit.Point(2D);
            styleRule1.Style.Padding.Right = Telerik.Reporting.Drawing.Unit.Point(2D);
            this.StyleSheet.AddRange(new Telerik.Reporting.Drawing.StyleRule[] {
            styleRule1});
            this.Width = Telerik.Reporting.Drawing.Unit.Inch(6.2677168846130371D);
            ((System.ComponentModel.ISupportInitialize)(this)).EndInit();
 
        }
Elian
Telerik team
 answered on 09 May 2013
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?