Previous TopicNext Topic


Tutorial 4: Building a report with side-by-side subreports

This section provides step-by-step instructions for building a report that displays a list of customers. For each customer, the report displays order and payment information. The order information and payment information are in separate, adjacent subreports. The customer report is the master report, which is also called the outer report. The order and payment subreports are the detail reports, which are also called the inner reports.

Each report accesses data from a different table in the sample database, Classic Models. The customer report, orders subreport, and payment subreport use data from the Customers, Orders, and Payments tables, respectively.

A common field, CUSTOMERNUMBER, links the reports. The value of the linking field in the master report determines what data appears in the detail reports. For example, if the customer number in the master report is 173, the detail reports display the order and payment information for the customer whose ID is 173.

Figure 13-1 shows a portion of the finished report.

Figure 13-1 Customers master report, with order and payment subreports

Figure 13-1 Customers master report, with order and payment subreports

In this tutorial, you perform the following tasks:

Task 1: Create a new report

If you are using BIRT Report Designer, this task assumes you have already created a project for your reports. If you are using BIRT RCP Report Designer, there is no requirement for a project.

  1. Choose File->New->Report.
  2. On New Report, select a project in which to store your report.
  3. Type the following text as the file name:
  4. Cust_Orders_Payments.rptdesign 
    
  5. Choose Finish. A blank report appears in the layout editor.

Task 2: Build a data source

Before you begin designing your report in the layout editor, you create a data source to connect your report to the Classic Models database.

  1. Choose Data Explorer.
  2. Right-click Data Sources, and choose New Data Source from the context menu.
  3. Select Classic Models Inc. Sample Database from the list of data sources, use the default data source name, then choose Next. Connection information about the new data source appears.
  4. Choose Finish. BIRT Report Designer creates a new data source that connects to the sample database. It appears within Data Sources in Data Explorer.

Task 3: Build a data set for the customer report

In this procedure, you build a data set to indicate what data to extract from the Customers table. The customer report that you create later uses this data set.

  1. In Data Explorer, right-click Data Sets, and choose New Data Set.
  2. On New Data Set, type the following text for data set name:
  3. Customers 
    
  4. Use the default values for the other fields:
    • Data Source shows the name of the data source that you created earlier.
    • Data Set Type specifies that the data set uses a SQL SELECT query.
  5. Choose Next. Query displays the information to help you create a SQL query. The text area on the right side shows the required keywords of a SQL SELECT statement.
  6. In Available Items, expand CLASSICMODELS, then expand the Customers table. The columns in the Customers table appear.
  7. Use the following SQL SELECT statement to indicate what data to retrieve. You can type the column and table names, or you can drag
    them from Available Items to the appropriate location in the SELECT statement:
  8. SELECT Customers.customerName, 
    Customers.customerNumber 
    FROM Customers 
    
    This statement that you created, which is shown in Figure 13-2, gets values from the CUSTOMERNAME and CUSTOMERNUMBER columns in the Customers table.

    Figure 13-2 Query

    Figure 13-2 Query
  9. Choose Finish to save the data set. Edit Data Set displays the columns specified in the query, and provides options for editing the data set.
  10. Choose Preview Results to confirm that the query is valid and that it returns the correct data. If you created the SELECT statement correctly, you should see the results that appear in Figure 13-3. These are the data rows that the query returns.
  11. Figure 13-3 Data preview

    Figure 13-3 Data preview
  12. Choose OK to save the data set.

Task 4: Build a data set for the orders subreport

In this procedure, you build a data set to indicate what data to extract from the Orders table. The orders subreport that you create later uses this data set.

  1. In Data Explorer, right-click Data Sets, and choose New Data Set from the context menu.
  2. On New Data Set, type the following text for the data set's name:
  3. Orders 
    
  4. Use the default values for the other fields, then choose Next.
  5. On Query, in Available Items, expand CLASSICMODELS, then expand the Orders table to display the columns in the table.
  6. Use the following SQL SELECT statement to indicate what data to retrieve:
  7. SELECT Orders.orderNumber, 
    Orders.orderDate 
    FROM Orders 
    WHERE Orders.customerNumber = ? 
    
    This statement selects the ORDERNUMBER and ORDERDATE columns from the Orders table. The WHERE clause has a parameter marker for the value of CUSTOMERNUMBER. When the report runs, the orders subreport gets the current CUSTOMERNUMBER value from the customers report.
  8. Choose Finish to save the data set. Edit Data Set displays the columns specified in the query, and provides options for editing the data set.
  9. Create a data set parameter to supply the CUSTOMERNUMBER value in the WHERE clause:
    1. Choose Parameters from the left side of the window. Edit Data Set displays a default parameter definition.
    2. Choose Edit to modify the parameter definition.
    3. On Edit Parameter, specify the following values, as shown in Figure 13-4:
      • Name: CustID
      • Data Type: Integer
      • Direction: Input
      • Default value: 103
      • 103 is one of the values in the CUSTOMERNUMBER column. A default value is required for BIRT Report Designer to run the query for testing purposes.
      • Linked To Report Parameter: None
      • Figure 13-4 Edited parameter definition

        Figure 13-4 Edited parameter definition
    4. Choose OK to confirm your edits to the parameter definition. The parameter definition appears in Edit Data Set, as shown in Figure 13-5.
    5. Figure 13-5 Parameter definition in the Orders data set

      Figure 13-5 Parameter definition in the Orders data set
  10. Choose Preview Results to confirm that the query is valid and that it returns the correct data. If you created the SELECT statement and created the data set parameter correctly, you should see the results that appear in Figure 13-6. These are the data rows that the query returns for customer number 103.
  11. Figure 13-6 Data preview for the orders subreport

    Figure 13-6 Data preview for the orders subreport
  12. Choose OK to save the changes to the data set.

Task 5: Build a data set for the payments subreport

In this procedure, you build a data set to indicate what data to extract from the Payments table. The payments subreport that you create later uses this data set.

  1. In Data Explorer, right-click Data Sets, and choose New Data Set from the context menu.
  2. On New Data Set, type the following text for the data set's name:
  3. Payments 
    
  4. Use the default values for the other fields, then choose Next.
  5. On Query, in Available Items, expand CLASSICMODELS, then expand the Payments table to display the columns in the table.
  6. Use the following SQL SELECT statement to indicate what data to retrieve:
  7. SELECT Payments.paymentDate, 
    Payments.checkNumber, 
    Payments.amount 
    FROM Payments 
    WHERE Payments.customerNumber = ? 
    
    This statement selects the PAYMENTDATE, CHECKNUMBER, and AMOUNT columns from the Payments table. The WHERE clause has a parameter marker for the value of CUSTOMERNUMBER. When the report runs, the payments subreport gets the current CUSTOMERNUMBER value from the customers report.
  8. Choose Finish to save the data set. Edit Data Set displays the columns specified in the query, and provides options for editing the data set.
  9. Create a data set parameter to supply the CUSTOMERNUMBER value for the WHERE clause:
    1. Choose Parameters. Edit Data Set displays a default parameter.
    2. Choose Edit to modify the parameter definition.
    3. On Edit Parameter, specify the following values:
      • Name: CustID
      • Data Type: Integer
      • Direction: Input
      • Default value: 103
      • Linked To Report Parameter: None
    4. Choose OK to confirm your edits to the parameter definition.
  10. Choose Preview Results to confirm that the query is valid and that it returns the correct data. If you created the SELECT statement and created the data set parameter correctly, you should see the results that appear in Figure 13-7. These are the data rows that the query returns for customer number 103.
  11. Figure 13-7 Data preview for the payments subreport

    Figure 13-7 Data preview for the payments subreport
  12. Choose OK to save the changes to the data set.

Task 6: Create the customer master report

You use a list element to create the master report and organize the orders and payments subreports within it. The list iterates through the customer data rows and creates the related orders and payments subreports for each record. For the sake of simplicity, the customer report displays just the customer name. It can, of course, display additional data, such as customer address, phone number, and credit limit.

  1. Choose Palette.
  2. Drag a list element from the palette, and drop it in the report. The list element appears in the report, as shown in Figure 13-8.
  3. Figure 13-8 List element

    Figure 13-8 List element
  4. Associate, or bind, the list with the Customers data set:
    1. In Property Editor, choose the Binding tab.
    2. In Data Set, select Customers from the drop-down list.
    BIRT creates a column binding for each column in the Customers data set. Figure 13-9 shows the binding information for the list.

    Figure 13-9 Binding information for the list element

    Figure 13-9 Binding information for the list element
  5. Choose Data Explorer, expand Data Sets, then expand Customers. The columns that you specified in the query appear below Customers.
  6. Drag CUSTOMERNAME from Data Explorer, and drop it in the detail area of the list. Figure 13-10 shows what the report design looks like so far.
  7. Figure 13-10 Data-set field in the list element

    Figure 13-10 Data set field in the list element
  8. Choose Preview to preview the report. The report should look like the one shown in Figure 13-11. The report lists all the customer names in the order in which the query returns them.
  9. Figure 13-11 Data preview for the master report

    Figure 13-11 Data preview for the master report
  10. Sort the customer names in ascending order:
    1. Choose Layout to return to the layout editor.
    2. In the layout editor, select the list element. Hover the mouse pointer over the bottom left corner until you see the List tab, then choose the tab.
    3. In Property Editor, choose the Sorting tab.
    4. On the Sort page, choose Add to create a sort expression.
    5. On New Sort Key, specify the following values, as shown in Figure 13-12.
      • In Key, select CUSTOMERNAME from the drop-down list.
      • In Direction, use the default value, Ascending.
      • Figure 13-12 Sort definition

        Figure 13-12 Sort definition
      Choose OK. The Sort page displays the sort expression that you defined for the list.

      Figure 13-13 Sort expression

      Figure 13-13 Sort expression
  11. Preview the report. Customer names appear in ascending order.

Task 7: Create the orders subreport

The orders subreport lists the orders for each customer in a row and column format. It displays the order number and date of each order. To iterate through the Orders data set rows and display them in a row and column format, you use the table element.

  1. Choose Layout to return to the layout editor.
  2. Drag a table element from the palette, and drop it below the [CUSTOMERNAME] data element, in the detail area. Insert Table prompts you to specify the number of columns and detail rows to create for the table. The dialog also prompts you to select a data set to bind with the table.
  3. On Insert Table, specify the following values, as shown in Figure 13-14.
    • In Number of columns, type 2.
    • In Number of details, type 1.
    • In Data Set, select Orders from the drop-down list.
    • Figure 13-14 Properties specified for the table

      Figure 13-14 Properties specified for the table
    Choose OK. A table appears in the detail area of the list, as shown in Figure 13-15.

    Figure 13-15 Table inserted in the detail area of the list

    Figure 13-15 Table inserted in the detail area of the list
  4. Choose Data Explorer, expand Data Sets, then expand Orders. The columns that you specified in the query appear below Orders.
  5. Drag ORDERNUMBER from Data Explorer, and drop it in the first cell of the table's detail row.
  6. In the layout editor, the table cell in which you dropped the data set field contains a data element that displays [ORDERNUMBER]. Above this data element is a label element that the layout editor automatically adds to the header row. This label displays the field name as static text and serves as the column heading.
  7. Drag ORDERDATE from Data Explorer, and drop it in the second cell in the detail row. The report page should look like the one shown in Figure 13-16.
  8. Figure 13-16 Report design includes the orders subreport

    Figure 13-16 Report design includes the orders subreport
  9. Sort the order rows by order number.
    1. Select the Orders table.
    2. In Property Editor, choose Sorting.
    3. On the Sort page, choose Add to create a sort expression.
    4. On New Sort Key, specify the following values:
      • In Key, select ORDERNUMBER from the drop-down list.
      • In Direction, use the default value, Ascending.
      Choose OK.
  10. Preview the report. The report should look like the one shown in Figure 13-17.
  11. Figure 13-17 Preview of the report shows repeated order records

    Figure 13-17 Preview of the report shows repeated order records
    The same order records appear for every customer, because you specified a default value of 103 for customerNumber when you created the data set parameter, CustID. Because of this default value, the orders subreport always displays the order records for customer 103. The solution is to dynamically update the value of the CustID parameter each time the customer row in the master report changes. This procedure is described in the following task.

Task 8: Link the orders subreport to the customers master report

You link the orders subreport to the customers master report by binding the CustID parameter to the CUSTOMERNUMBER data set field in the customers report. Each time the customers report reaches a new customer row, the CustID parameter is updated with the new CUSTOMERNUMBER value.

  1. Choose Layout to return to the layout editor.
  2. Select the Orders table.
  3. In Property Editor, choose Binding.
  4. On the Binding page, choose Dataset Parameter Binding. Dataset Parameter Binding displays the CustID parameter, as shown in Figure 13-18. Its value is set to the default, 103, which you specified when you created the data set parameter.
  5. Figure 13-18 Dataset Parameter Binding for the Orders table

    Figure 13-18 Dataset Parameter Binding for the Orders table
  6. Change the parameter value to the CUSTOMERNUMBER field in the customers report.
    1. Select the parameter, then choose Edit. Edit data set parameter binding, shown in Figure 13-19, prompts you to specify a new parameter value.
    2. Figure 13-19 Edit data set parameter binding

      Figure 13-19 Edit data set parameter binding

    3. Choose the expression builder button that appears on the right of the Value field.
    4. On the expression builder, choose Available Column Bindings, choose List, then double-click CUSTOMERNUMBER. The expression builder displays the expression, row["CUSTOMERNUMBER"], as shown in Figure 13-20.
    5. Figure 13-20 CUSTOMERNUMBER field in expression builder

      Figure 13-20 CUSTOMERNUMBER field in the expression builder
      Choose OK to save the expression and close the expression builder.
    6. On Edit data set parameter binding, choose OK to accept the new parameter value. Dataset Parameter Binding displays the new value of row["CUSTOMERNUMBER"] for the CustID parameter.
  7. Choose OK to save the changed data set parameter binding.
  8. Preview the report, which should look like the one shown in Figure 13-21.
  9. Figure 13-21 Preview of the report shows correct orders data

    Figure 13-21 Preview of the report shows correct orders data
    Now different order records appear for different customers. Not all customers have order records. To display only customers that have orders, you change the query for the customers report. This task is described later in Task 11: "Display only customers that have orders or payments."

Task 9: Create the payments subreport

The payments subreport shows, in a row and column format, the payments that each customer made. It displays the payment date, check number, and amount of each order. To iterate through the Payments data set rows and display them in a row and column format, you use a table element. This time, you use an alternate and quicker method to insert the table and the data set fields in the table.

  1. Choose Layout to return to the layout editor.
  2. Choose Data Explorer, and expand Data Sets.
  3. Drag the Payments data set, and drop it below the orders subreport, in the detail area of the list.
  4. BIRT Report Designer inserts a table in the report, and places all the data set fields in the detail row of the table. BIRT Report Designer also inserts labels in the header row of the table. The labels display the field names as static text and serve as the column headings. The report design should look like the one shown in Figure 13-22.

    Figure 13-22  Report design includes the payments subreport

    Figure 13-22 Report design includes the payments subreport
  5. Sort the payment rows by payment date.
    1. Select the Payments table.
    2. In Property Editor, choose Sorting.
    3. On the Sort page, choose Add to create a sort expression.
    4. On New Sort Key, specify the following values:
      • In Key, select PAYMENTDATE from the drop-down list.
      • In Direction, use the default value, Ascending.
      Choose OK.
  6. Preview the report. The report should look like the one shown in Figure 13-23.
  7. Figure 13-23 Report preview shows repeated payments records

    Figure 13-23 Report preview shows repeated payments records
    As with the orders subreport when you first created it, the same payment records repeat for every customer, because you specified a default value of 103 for customerNumber when you created the parameter, CustID, for the Payments data set. Because of this default value, the payments subreport always displays the payment records for customer 103. Just as you did for the orders subreport, you need to dynamically update the value of the CustID parameter for each customer in the master report.

Task 10: Link the payments subreport to the customers master report

You link the payments subreport to the customers master report by binding its CustID parameter to the CUSTOMERNUMBER field in the customers report.

  1. Choose Layout to return to the layout editor.
  2. Select the Payments table.
  3. In Property Editor, choose the Binding tab.
  4. On the Binding page, choose Dataset Parameter Binding. Dataset Parameter Binding displays the CustID parameter. Its value is set to the default, 103, which you specified when you created the data set parameter.
  5. Change the parameter value to the CUSTOMERNUMBER field in the customers report:
    1. Select the parameter, then choose Edit. A dialog prompts you specify a parameter value.
    2. Choose the expression builder button that appears on the right of the Value field.
    3. On the expression builder, choose Available Column Bindings, choose List, then double-click CUSTOMERNUMBER. The expression builder displays the expression row["CUSTOMERNUMBER"].
    4. Choose OK to save the expression and close the expression builder.
    5. On Edit data set parameter binding, choose OK to accept the new parameter value. Dataset Parameter Binding displays the new value of row["CUSTOMERNUMBER"] for the CustID parameter, as shown in Figure 13-24.
    6. Figure 17-24 Modified data set parameter binding for the Payments table

      Figure 13-24 Modified data set parameter binding for the Payments table
  6. Choose OK to save the changed data set parameter binding.
  7. Preview the report. Now the report displays different payment records for different customers. Not all customers have payment records. To display only customers that have payments or orders, you change the query for the customers report.

Task 11: Display only customers that have orders or payments

The database contains customers that do not have orders or payments. The query for the customers report returns all customers. When you run the report, there are customer rows that show only the column headings for the Orders and Payments tables, as shown in Figure 13-25.

Figure 13-25 Report shows no order or payment data for one customer

Figure 13-25 Report shows no order or payment data for one customer

You can exclude customers that do not have orders or payments by changing the query for the customers report.

  1. Choose Layout to return to the layout editor.
  2. In Data Explorer, expand Data Sets, right-click Customers, then choose Edit.
  3. Add the following SQL lines to the end of the existing query:
  WHERE  
  EXISTS  
  (SELECT Orders.customerNumber 
  FROM Orders  
  WHERE Customers.customerNumber =  
  Orders.customerNumber) 
  OR 
  EXISTS  
  (SELECT Payments.customerNumber 
  FROM Payments  
  WHERE Customers.customerNumber =  
  Payments.customerNumber) 

Task 12: Display the subreports next to one another

Now that the subreports display the correct data, you can focus on laying out the subreports next to one another. You cannot place two tables next to one another, because BIRT Report Designer creates block-level elements, which means that each element starts on a new line. To display side-by-side tables, you insert the tables in a grid. The grid enables you to align elements easily.

  1. Choose Layout to return to the layout editor.
  2. Drag a grid element from the palette, and drop it into the Detail row, between the [CUSTOMERNAME] data element and the Orders table. Before you drop the grid, verify that the straight cursor appears on the left side of the Orders table.
  3. Insert Grid prompts you to specify the number of columns and rows for the grid.
  4. In Number of columns, type 2 and in Number of rows, type 1, then choose OK. A grid with two columns and one row appears in the layout editor.
  5. Move the Orders table to the first grid cell. To do this, select the Table tab in the bottom left corner of the table, then drag the table and drop it in the grid cell.
  6. Move the Payments table to the second grid cell. The report layout should look like the one shown in Figure 13-27.
  7. Figure 13-27 Side-by-side subreports in the report design

    Figure 13-27 Side-by-side subreports in the report design
  8. Preview the report. The report should look like the one shown in Figure 13-28.
  9. Figure 13-28 Report preview showing side-by-side subreports

    Figure 13-28 Report preview showing side-by-side subreports

Task 13: View the outline of the report

This report contains several levels of nested elements. At the top-most level is the list element. Within the list is a grid, which contains two tables. Within each table are data elements. The layout editor shows the borders of container elements and data elements, but with several levels of nested elements, it can be difficult to see and select individual elements.

To get a clear view of the hierarchy of elements, use the Outline view. Figure 13-29 shows the outline of the report. Select Body, then expand each item to view all the elements in the report.

Figure 13-29 Outline of the report

Figure 13-29 Outline of the report

If you have difficulty selecting an element in the layout editor, select the element in the Outline view. When you select an element in Outline, the element is selected in the layout editor.

Task 14: Format the report

Now that the report displays the correct data and layout, you can turn your attention to improving the report's appearance. You perform the following tasks in this section:

Highlight the customer names

  1. Choose Layout to return to the layout editor.
  2. In the layout editor, select the [CUSTOMERNAME] data element.
  3. Choose the Properties tab of Property Editor.
  4. Select General from the list under Properties. Property Editor displays the general formatting properties of the data element.
  5. For Size, choose Large to display the element's text in a larger size.
  6. Choose B to format the data as bold text.

Edit the column headings

When you insert a data set field in a table, BIRT Report Designer automatically adds a label with the data set field name in the header row. Often, data set field names are not in a form that is appropriate for reports, and need to be changed.

  1. Double-click the first column heading in the Orders table. The text is highlighted.
  2. Replace ORDERNUMBER with the following text, then press Enter:
  3. Order Number 
    
  4. Repeat the previous steps to change the rest of the column headings to the following text:
  5. Order Date 
    Payment Date 
    Check Number 
    Amount 
    
    The report layout should look like the one shown in Figure 13-30.

    Figure 13-30 Edited column headings in the report design

    Figure 13-30 Edited column headings in the report design
  6. Preview the report. The report should look like the one shown in Figure 13-31.
  7. Figure 13-31 Edited column headings in the report preview

    Figure 13-31 Edited column headings in the report preview

Change the date formats

When you insert a data element of date data type, BIRT Report Designer displays dates according to your system's locale setting. BIRT Report Designer provides many different date formats that you can select if you do not want to use the default format. In this procedure, you create a style that changes the format of ORDERDATE and PAYMENTDATE values from Jun 3, 2005 to 6/3/05.

  1. Choose Layout to return to the layout editor.
  2. Select the data element that displays [ORDERDATE].
  3. Choose Element->New Style from the main menu. New Style displays the properties you can set for a style, as shown in Figure 13-32.
  4. Figure 13-32  New Style

    Figure 13-32 New Style
  5. For Custom Style, type:
  6. Date_data 
    
  7. Choose Format DateTime from the list of style properties on the left.
  8. Choose the m/d/yy format from the drop-down list, as shown in Figure 13-33. The values in the drop-down list dynamically update with the current date.
  9. Figure 13-33 DateTime formats

    Figure 13-33 DateTime formats
  10. Choose OK.
  11. The Date_data style is applied to the [ORDERDATE] data element, as shown in Figure 13-34.

    Figure 13-34 Date_data style applied to a data element

    Figure 13-34 Date_data style applied to a data element
  12. Apply the Date_data style to the payment date data element.
    1. Select the data element that displays [PAYMENTDATE].
    2. Right-click the selected element, then choose Style->Apply Style->Date_data.
  13. Preview the report. The dates have changed from Mar 18, 2003 format to 3/18/03 format, as shown in Figure 13-35.
  14. Figure 13-35 Changed date formats in the report preview

    Figure 13-35 Changed date formats in the report preview

Change the number formats

When you insert a data element of integer data type, BIRT Report Designer displays numbers according to your system's locale setting. BIRT Report Designer provides many different number formats that you can select if you do not want to use the default format. In this procedure, you create a style that changes the amount values format from 48425.69 to $48,425.69.

  1. Choose Layout to return to the layout editor.
  2. Select the data element that displays [AMOUNT] in the Payments table.
  3. Choose Element->New Style from the main menu. New Style displays properties in the general category.
  4. For Custom Style, type:
  5. Currency_data 
    
  6. Choose Format Number from the list of style properties on the left.
  7. Specify the following formatting attributes, as shown in Figure 13-36:
    • For Format as, select Currency from the drop-down list.
    • For Decimal places, use the default value of 2.
    • Select Use 1000s separator.
    • For Symbol, select $ from the drop-down list.
    • Use the default values for the other attributes.
    • Figure 13-36 Format Number properties

      Figure 13-36 Format Number properties
  8. Choose OK to save the style. The Currency_data style is applied to the [AMOUNT] data element, as indicated by the element's Style property in Property Editor.
  9. Preview the report. The numbers appear in the currency format, as shown in Figure 13-37.
  10. Figure 13-37 Currency format in the report preview

    Figure 13-37 Currency format in the report preview

Increase the vertical space between elements

In this procedure, you increase the space between each customer name and the lines before and after it. You can adjust the vertical space between elements in several ways:

Formatting with a grid is easier and provides more predictable results. Padding and margins property values can yield different results in different web browsers. In this procedure, you use the third method.

  1. Choose Layout to return to the layout editor.
  2. Place the [CUSTOMERNAME] data element in the grid that contains the two tables by completing the following steps:
    1. Select the grid. Hover the mouse pointer over the bottom left corner until you see the Grid tab, then choose the tab. Guide cells appear at the top and left of the selected grid.
    2. Right-click the guide cell on the left of the grid's first row, then choose Insert->Row->Above, as shown in Figure 13-38.
    3. Figure 13-38  Inserting a new row

      Figure 13-38 Inserting a new row
      A new row appears above the selected row.
    4. Move the [CUSTOMERNAME] data element from its current location to the first cell of the new grid row. Figure 13-39 shows the [CUSTOMERNAME] data element in the new location.
    5. Figure 13-39 Data element moved to the new row

      Figure 13-39 Data element moved to the new row
  3. Using the procedures for adding a row that were described earlier:
    • Add a new grid row above the row that contains the [CUSTOMERNAME] data element.
    • Add a new grid row below the row that contains the {CUSTOMERNAME] data element.
  4. Select the grid, then select the first row in the grid, as shown in Figure 13-40.
  5. Figure 13-40 Selecting the first row

    Figure 13-40 Selecting the first row
  6. In the General properties of Property Editor, set the row's height to 0.2 in, as shown in Figure 13-41.
  7. Figure 13-41 Setting the row height property

    Figure 13-41 Setting the row height property
  8. Select the third row in the grid, and set its height to 0.1 in. The report design should look like the one shown in Figure 13-42.
  9. The custom row heights provide the exact amount of space you need between elements. If you prefer to work with a unit of measurement other than inches, you can select mm, points, or even pixels for very precise sizing control.

    Figure 13-42 New row heights in the report design

    Figure 13-42 New row heights in the report design
  10. Preview the report. There is more space above and below the customer name. The report should look like the one shown in Figure 13-43.
  11. Figure 13-43 Report preview showing added space

    Figure 13-43 Report preview, showing added space

Increase the horizontal space between the Orders and Payments tables

In this procedure, you increase the space between the Orders and Payments tables. As with vertical spacing, you can adjust the horizontal space between elements in several ways:

Again, formatting with a grid is easier and provides more predictable results. Padding and margins property values can yield different results in different web browsers. In this procedure, you use the third method.

  1. Choose Layout to return to the layout editor.
  2. Select the grid. Hover the mouse pointer over the bottom left corner until you see the Grid tab, then choose the tab. Guide cells appear at the top and left of the selected grid.
  3. Right-click the guide cell above the first column, then choose Insert->Column to the Right, as shown in Figure 13-44.
  4. Figure 13-44 Inserting a column

    Figure 13-44 Inserting a column
    A new column appears between the first and third columns. By default, BIRT Report Designer creates columns with the same widths.
  5. Select the column that you just added, and use Property Editor to set the column width to 0.4 in, as shown in Figure 13-45.
  6. Figure 13-45 Setting a column width

    Figure 13-45 Setting a column width
    The width of the second column decreases.
  7. Preview the report. There is more space between the Orders and Payments tables, as shown in Figure 13-46.
  8. Figure 13-46 Report preview, showing added space between tables

    Figure 13-46 Report preview, showing added space between tables

Add borders around the tables

In this procedure, you add a box around the Orders and Payments tables to clearly identify them as two separate subreports.

  1. Choose Layout to return to the layout editor.
  2. Select the Orders table. Hover the mouse pointer over the bottom left corner until you see the Table tab, then choose the tab. Guide cells appear at the top and left of the selected table.
  3. Choose Border in Property Editor, then set the border properties:
    • Set Style to a solid line, the default option.
    • Set Color to black, the default color.
    • Set Width to the thinnest line.
    • Choose the All Borders button to add borders to all sides of the table, as shown in Figure 13-47.
    • Figure 13-47 Adding borders to a table

      Figure 13-47 Adding borders to a table
  4. Repeat the previous steps to draw a border around the Payments table.
  5. Preview the report. The report should look like the one shown in Figure 13-48.
  6. Figure 13-48 Borders around tables in report preview

    Figure 13-48 Borders around tables in report preview

Increase the space between the table borders and contents

The top and left borders of the tables are too close to the table content. In this procedure, you increase the space between the top and left borders and the content.

  1. Choose Layout to return to the layout editor.
  2. Select the first cell in the group header row of the Orders table. Be careful to select the cell, as shown in Figure 13-49, and not the data element in the cell.
  3. Figure 13-49 Selecting a cell

    Figure 13-49 Selecting a cell
    The title bar of Property Editor shows the type of the element that you selected. Verify that it displays the following text:
    Property Editor - Cell 
    
  4. Choose the Padding properties in Property Editor, then set Top and Left to 6 points. Use the default values for Bottom and Right. Figure 13-50 shows these property settings.
  5. Figure 13-50 Cell padding properties in Property Editor

    Figure 13-50 Cell padding properties in Property Editor
    In the layout editor, extra space appears at the top and left of the cell, as shown in Figure 13-51.

    Figure 13-51 Cell padding in the report design

    Figure 13-51 Cell padding in the report design
  6. In the Orders table, select the other cells that contain elements, and set the Top and Left padding properties to 6 points.
  7. Similarly, in the Payments table, select all the cells that contain elements, and set the Top and Left padding properties to 6 points.
  8. Preview the report. The report should look like the one shown in Figure 13-52.
  9. Figure 13-52 Report preview shows more space within the tables

    Figure 13-52 Report preview shows more space within the tables


(c) Copyright Actuate Corporation 2006

Previous TopicNext Topic