Web Designer
Get Started / Tutorial 5: Create Pivot Report / Tutorial 5.1: Create a Simple Pivot Report
In This Topic
    Tutorial 5.1: Create a Simple Pivot Report
    In This Topic

    A simple Pivot report contains a Tablix data region. This report uses the default row and column groups to display data.

    What You Will Learn

    This tutorial guides you through the steps to create a simple Pivot report using Tablix data region.

    Note: This tutorial uses shared data set - CustomerOrders.

    After you complete this tutorial, you will have a report that looks similar to the following.

    An Example for Simple Pivot Report

    Access the ActiveReports Web Designer

    Run the Web Designer sample (WebDesigner_MVC(Core)) that you can download from the following link:

    https://github.com/activereports/WebSamples14/tree/master/WebDesignerSamples

    The Web Designer is opened in browser ready to create your reports.

    Create Report Layout

    Drag and drop Tablix data region Tablix Toolbar Icon onto the design area of the report.
    Dragging the Tablix data region onto the design area
    You see a row group area and a column group area as shown.
    Tablix data region with a row group area and a column group area

    To add a static row to display labels (static text) for the column group,

    1. Right-click the column group area to view the options in the context menu.
    2. Go to Row and select Outside Group - Above.
      Adding a static row for the column group using context menu
      Now the tablix in the design area looks as shown.
      Tablix data region with the added static row for the column group

    Bind Data to Tablix Data Region

    Let us now populate the Tablix data region with data. We want the titles to be displayed along the rows, different media types along the columns, and the total price corresponding to these.

    1. Click the drop down next to the CustomerOrders data set to view fields in the added data set.
    2. Drag and drop the Title field onto the row group area as shown.
       Bind data to table data region
    3. Drag and drop the MediaType field on the column group.
      Bind data to table data region
    4. Similarly, drag and drop the Price field onto the body of the tablix.
      Bind data to table data region

      To display the aggregate price for the media types,

    5. Select the body area containing Price field.
    6. Go to Properties pane and select the radio button next to Value property.
    7. Select Expression... from the drop down and enter the following expression in the Expression Editor:
       =Sum(Fields!Price.Value).
      Expression Editor Dialog

      Expression Editor Dialog

    Add Labels to Tablix Data Region

    To merge the cells in the tablix corner area (top left),

    1. Select the cells in the tablix corner area using mouse drag or simply using Ctrl+Click combination.
    2. Right-click the selected cells to view the options in the context menu, go to Cells, and select Merge Cells.
      Merging the cells in the Tablix corner area using the context menu

      To provide labels to the columns,

    3. Enter text 'Prices by Media Type'.
    4. Select the text box above the column group MediaType and enter the text 'Media Type'.
      Now the tablix has column labels as shown.
      Adding labels to Tablix data region

    Manage Data

    In Tablix data region, you need to manage how a grouped data is rendered across the rows and columns. This is done by using Group Expressions as explained below.

    1. From the Explorer report Explorer Icon, select the Tablix data region.
    2. Click the Group Editor icon Group Editor Icon to display row groups and column groups.

      To display the titles once for every row group:

    3. Select Tablix1_Title1 row group and go to the Properties pane.
    4. In the Group Expressions property, click Show Items and then select Add Item.
    5. Click the radio button to display the fields and select the Title field.

      To display the media types once for every column group:

    6. Select Tablix1__MediaType1 column group and go to the Properties pane.
    7. In the Group Expressions property, click Show Items and then select Add Item.
    8. Click the radio button to display the fields and select the MediaType field.

    Add Report Title

    1. Drag and drop a TextBox control Textbox Toolbar Icon above the tablix. If required, relocate the tablix to create space for the text box.
    2. Click inside the text box and enter the text 'Customer Orders Price List'.

    Customize the Appearance of the Pivot Report

    Customized Pivot Report

    Note: You may need to resize and reposition the controls on the report to accommodate data, and for a cleaner look.

    1. To apply borders to tablix, select the Tablix data region and set the BORDER - Style property to Solid.
    2. To customize the static row of the tablix and the title of the report, set the following properties for text boxes with text 'Prices by Media Type', 'Media Type', and 'Customer Orders Price List'.
      Property Value
      BACKGROUND - Color Plum
      TEXT - Font Weight Bold
      TEXT - Text Align Center
      BORDER - Style Solid
    3. To customize the body area and group area of the tablix, set the following properties.
      Property Value
      Body area (=Sum([Price]))
      BORDER - Style Solid
      TEXT - Text Align Center
      Row group area (=[Title])
      BORDER - Style Solid
      Column group area (=[MediaType])
      TEXT - Text Align Center
      BACKGROUND - Color MediumOrchid

    Preview and Save Report

    1. Click Preview Preview Button to view your report in the final output.
    2. Exit the preview mode by clicking Back on the top left side of the designer.
    3. Click Save to open the Save dialog box. Enter the report name and click Save Report.