[]
        
(Showing Draft Content)

Cross-Tab Reports

Cross-tab reports group data in two dimensions (down and across). They are useful for summarizing large amounts of data in a format that cross-references information.

The following steps create a cross-tab report in the report created in Quick Start.

  1. Add a Button to the Form in the FlexReport Quick Start project.

  2. Set the Button Name to 'crossC1Button' and Text to 'View Cross Tab-Report'.

  3. Create Click event as crossC1Button_Click.

  4. Write the following code.

    Group grp2;
    private void crossC1Button_Click(object sender, EventArgs e) {
      btnEmployees.PerformClick();
      c1FlexReport1.Sections.Detail.Visible = false;
      grp2 = c1FlexReport1.Groups.Add("GrpCountry", "Country", SortEnum.Ascending);
      // format the Header section for the new group       
      c1FlexReport1.Sections.PageHeader.Height = 600;
      shpfld2.Top = 600;
      s = grp2.SectionHeader;
      s.Height = 400;
      s.AutoHeight = AutoSizeBehavior.GrowAndShrink;
      s.Visible = true;
      textFld4.Text = "Country";
      textFld4.Width = 1000;
      textFld4.Align = FieldAlignEnum.CenterMiddle;
      textFld4.Height = 400;
      textFld4.Font.Bold = true;
      textFld4.Font.Size = 10;
      textFld5.Text = "Total";
      textFld5.Width = 1000;
      textFld5.Left = 1000;
      textFld5.Align = FieldAlignEnum.CenterMiddle;
      textFld5.Height = 400;
      textFld5.Font.Bold = true;
      textFld5.Font.Size = 10;
      textFld6.Text = "Sales Representative";
      textFld6.Width = 2000;
      textFld6.Left = 2000;
      textFld6.Align = FieldAlignEnum.CenterMiddle;
      textFld6.Height = 500;
      textFld6.Font.Bold = true;
      textFld6.Font.Size = 10;
      textFld7.Text = "Vice President";
      textFld7.Width = 1500;
      textFld7.Left = 4000;
      textFld7.Align = FieldAlignEnum.CenterMiddle;
      textFld7.Height = 400;
      textFld7.Font.Bold = true;
      textFld7.Font.Size = 10;
      textFld8.Text = "Sales Manager";
      textFld8.Width = 1500;
      textFld8.Left = 5800;
      textFld8.Align = FieldAlignEnum.CenterMiddle;
      textFld8.Height = 400;
      textFld8.Font.Bold = true;
      textFld8.Font.Size = 10;
      TextField isc = new TextField();
      isc.Text = "Inside Sales Coordinator";
      isc.Width = 1500;
      isc.Left = 7500;
      isc.Align = FieldAlignEnum.CenterMiddle;
      isc.Height = 400;
      isc.Font.Bold = true;
      isc.Font.Size = 10;
      isc.Visible = true;
      c1FlexReport1.Sections.PageHeader.Fields.Add(isc);
      Field f1 = new Field();
      f1.Name = "Country";
      f1.Text = "Country";
      f1.Left = 80;
      f1.Top = 0;
      f1.Width = 1000;
      f1.Height = 400;
      f1.Align = FieldAlignEnum.CenterMiddle;
      f1.MarginLeft = 100;
      f1.Calculated = true;
      f1.Visible = true;
      f1.BackColor = Color.Transparent;
      f1.Font.Bold = true;
      f1.Font.Size = 10;
      s.Fields.Add(f1);
      TextField f7 = new TextField();
      f7.Name = "RunCount";
      f7.Text = "=Count(Title)";
      f7.Left = 1080;
      f7.Top = 0;
      f7.Width = 1000;
      f7.Height = 400;
      f7.Align = FieldAlignEnum.CenterMiddle;
      f7.MarginLeft = 100;
      f7.Visible = true;
      f7.Font.Bold = true;
      f7.Font.Size = 10;
      s.Fields.Add(f7);
      TextField f8 = new TextField();
      f8.Name = "SRCount";
      f8.Text = "=Count(Title, Title = \"Sales Representative\")";
      f8.Left = 2080;
      f8.Top = 0;
      f8.Width = 1000;
      f8.Height = 400;
      f8.Align = FieldAlignEnum.CenterMiddle;
      f8.MarginLeft = 100;
      f8.Visible = true;
      f8.Font.Bold = true;
      f8.Font.Size = 10;
      s.Fields.Add(f8);
      TextField f9 = new TextField();
      f9.Name = "VPCount";
      f9.Text = "=Count(Title, Title = \"Vice President, Sales\")";
      f9.Left = 4000;
      f9.Top = 0;
      f9.Width = 1000;
      f9.Height = 400;
      f9.Align = FieldAlignEnum.CenterMiddle;
      f9.MarginLeft = 100;
      f9.Visible = true;
      f9.Font.Bold = true;
      f9.Font.Size = 10;
      s.Fields.Add(f9);
      TextField f10 = new TextField();
      f10.Name = "SMCount";
      f10.Text = "=Count(Title, Title = \"Sales Manager\")";
      f10.Left = 5800;
      f10.Top = 0;
      f10.Width = 1000;
      f10.Height = 400;
      f10.Align = FieldAlignEnum.CenterMiddle;
      f10.MarginLeft = 100;
      f10.Visible = true;
      f10.Font.Bold = true;
      f10.Font.Size = 10;
      s.Fields.Add(f10);
      TextField f11 = new TextField();
      f11.Name = "ISCCount";
      f11.Text = "=Count(Title, Title = \"Inside Sales Coordinator\")";
      f11.Left = 7500;
      f11.Top = 0;
      f11.Width = 1000;
      f11.Height = 400;
      f11.Align = FieldAlignEnum.CenterMiddle;
      f11.MarginLeft = 100;
      f11.Visible = true;
      f11.Font.Bold = true;
      f11.Font.Size = 10;
      s.Fields.Add(f11);
      c1FlexReport1.Render();
    }
    
  5. Run the project. Click 'View Cross Tab-Report' button to view cross-tab report. Observe that the details corresponding to the employee titles in the two countries are shown.

    Cross-Tab Report