## Tutorial 3: 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 subreports that appear next to one another. The customer report is the master report, which is also called the outer report, and 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 uses data from the Customers table. The orders subreport uses data from the Orders table. The payments subreport uses data from the Payments table.

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

In this tutorial, you perform the following tasks:

- Create a new report.
- Build a data source.
- Build a data set for the customer report.
- Build a data set for the orders subreport.
- Build a data set for the payments subreport.
- Create the customer master report.
- Create the orders subreport.
- Link the orders subreport to the customers master report.
- Create the payments subreport.
- Link the payments subreport to the customers master report.
- Display only customers that have orders or payments.
- Display the subreports next to one another.
- Format the report.

### 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:

    Cust_Orders_Payments.rptdesign

4. Choose Next.
5. Select Blank Report, then choose Finish. The new 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:

    Customers

3. 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.

4. 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.
5. Expand the CUSTOMERS table. The columns in the Customers table appear.
6. 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 the left side to the appropriate location in the SELECT statement.

    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
7. 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.
8. 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.

Figure 13-3 Data preview
9. Choose OK.

### 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:

    Orders

3. Use the default values for the other fields, then choose Next.
4. On Query, expand the Orders table to display the columns in the table.
5. Use the following SQL SELECT statement to indicate what data to retrieve:

    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.
6. 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.
7. 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 parameters information.
2. Specify the following values in the first line of the table:

- 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.

Edit Data Set should look like the one shown in Figure 13-4.

Figure 13-4 Parameter definition in the orders subreport
8. 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-5. These are the data rows that the query returns for customer number 103.

Figure 13-5 Data preview for the orders subreport
9. 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:

    Payments

3. Use the default values for the other fields, then choose Next.
4. On Query, expand the Payments table to display the columns that are in the table.
5. Use the following SQL SELECT statement to indicate what data to retrieve:

    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.
6. 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.
7. Create a data-set parameter to supply the CUSTOMERNUMBER value for the WHERE clause:

1. Choose Parameters. Edit Data Set displays parameters information.
2. Specify the following values in the first line of the table:

- Name: CustID
- Data Type: Integer
- Direction: Input
- Default value: 103

8. 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.

Figure 13-6 Data preview for the payments subreport
9. 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-7.

Figure 13-7 List element
3. Associate, or bind, the list with the Customers data set:

1. In Property Editor, choose the Binding tab.
2. For Data Set, select Customers from the drop-down list.

4. Choose Data Explorer, expand Data Sets, then expand Customers. The columns that you specified in the query appear below Customers.
5. Drag CUSTOMERNAME from Data Explorer, and drop it in the detail area of the list. BIRT Report Designer creates a named column, which is bound to the data-set field. Select Data Binding displays this column binding.
6. Choose OK to accept the default column binding. In the layout editor, the list displays the field that you added, as shown in Figure 13-8.

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

Figure 13-9 Data preview for the master report
8. 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. A row appears under Sort on.
5. Click the area under Sort Key, then select the arrow button that appears, and select CUSTOMERNAME from the drop-down list.
6. Use the default value, Ascending, for Sort Direction, as shown in Figure 13-10.

Figure 13-10 Sort expression

9. 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.
3. Indicate that you want to create 2 columns and 1 detail row, then choose OK. A table with two columns and one detail row appears in the layout editor.
4. Bind the table with the Orders data set:

1. In Property Editor, choose Binding.
2. For Data set, select Orders from the drop-down list.

5. Choose Data Explorer, expand Data Sets, then expand Orders. The columns that you specified in the query appear below Orders.
6. Drag ORDERNUMBER from Data Explorer, and drop it in the first cell of the table's detail row. BIRT Report Designer creates a named column, which is bound to the data-set field. Select Data Binding displays this column binding.
7. Choose OK to accept the default column binding.
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.
8. Drag ORDERDATE from Data Explorer, and drop it in the second cell in the detail row. Choose OK to accept the default column binding. The report page should look like the one shown in Figure 13-11.

Figure 13-11 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. A row appears under Sort on.
4. Click the area under Sort Key, then select the arrow button that appears, and select ORDERNUMBER from the drop-down list.
5. Use the default value, Ascending, for Sort Direction.

10. Preview the report.
The report should look like the one shown in Figure 13-12.

Figure 13-12 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.

Before you can bind the CustID parameter to the CUSTOMERNUMBER data-set field, you must create a column binding and bind it with the data-set field. Parameters cannot access data-set fields directly.

1. Choose Layout to return to the layout editor.
2. Create a column binding that binds to the CUSTOMERNUMBER data-set field:

1. Select the list.
2. In Property Editor, choose Binding.
3. On the Binding page, choose Add.
4. On Expression Builder, choose Available Data Sets, choose Customers, then double-click CUSTOMERNUMBER. Expression Builder displays the expression, dataSetRow["CUSTOMERNUMBER"], as shown in Figure 13-13.

Figure 13-13 Expression Builder shows the column binding expression
5. Choose OK. The new column binding appears on the binding page of Property Editor with the column name highlighted.
6. Replace the name New Binding with the following name:

    CUSTOMER_NUMBER

3. Select the orders table.
4. In Property Editor, choose Binding.
5. On the Binding page, choose Dataset Parameter Binding. Dataset Parameter Binding displays the CustID parameter, as shown in Figure 13-14. Its value is set to the default, 103, which you specified when you created the data-set parameter.

Figure 13-14 Dataset Parameter Binding for the orders table
6. Change the parameter value to the CUSTOMERNUMBER field in the customers report:

1. Click the Value field, then choose the button that appears on the right.
Expression Builder appears.
2. On Expression Builder, choose Available Column Bindings, choose List, then double-click CUSTOMER_NUMBER. Expression Builder displays the expression, row["CUSTOMER_NUMBER"], as shown in Figure 13-15.

Figure 13-15 CUSTOMERNUMBER field in Expression Builder
3. Choose OK to save the expression. The Dataset Parameter Binding page displays the new value of row["CUSTOMER_NUMBER"] 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-16.

Figure 13-16 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.

1. Choose Layout to return to the layout editor.
2. Drag a table element from the palette, and drop it below the orders subreport, in the detail area. Insert Table prompts you to specify the number of columns and detail rows to create for the table.
3. Indicate that you want to create 3 columns and 1 detail row, then choose OK. A table with three columns and one detail row appears in the layout editor.
4. Bind the table with the Payments data set:

1. In Property Editor, choose Binding.
2. For Data set, select Payments from the drop-down list.

5. Choose Data Explorer, expand Data Sets, then expand Payments. The columns that you specified in the query appear below Payments.
6. Drag the following fields from Data Explorer, and drop them in the first, second, and third cells, respectively, in the detail row of the table. Choose OK to accept the default column bindings for all the fields.

- PAYMENTDATE
- CHECKNUMBER
- AMOUNT

The report page should look like the one shown in Figure 13-17.

Figure 13-17 Report design includes the payments subreport
The table shows the data-set fields that you added. It also shows the labels that the layout editor automatically added to the header row. The labels display the field names as static text and serve as the column headings.
7. Sort the payment rows by payment date.

1. Select the payments table.
2. In Property Editor, choose Sorting.
3. On the Sorting page, choose Add to create a sort expression. A row appears under Sort on.
4. Click under Sort Key, choose the arrow button that appears, and select PAYMENTDATE from the drop-down list.
5. Use the default value, Ascending, for Sort Direction.

8. Preview the report. The report should look like the one shown in Figure 13-18.

Figure 13-18 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. Click the Value field, then choose the button that appears on the right.
2. On Expression Builder, choose Available Column Bindings, choose List, then double-click CUSTOMER_NUMBER. Expression Builder displays the expression row["CUSTOMER_NUMBER"].
3. Choose OK to save the expression. The Dataset Parameter Binding page displays the new value of row["CUSTOMER_NUMBER"] for the CustID parameter.

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-19.

Figure 13-19 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)

The WHERE EXISTS clause checks the Orders and Payments tables for customerNumber values that match the customerNumber values in the Customers table. Only rows that have matching customerNumber values are selected. The complete query should look like the one shown in Figure 13-20.

Figure 13-20 WHERE EXISTS clause in Edit Data Set
4. Choose Preview Results to verify that the query returns rows, then choose OK.
5. Preview the report. Scroll down the report to check the output. The report no longer displays customers that do not have orders or payments.

### 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 above the orders table. Insert Grid prompts you to specify the number of columns and rows for the grid.
3. 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.
4. Move the orders table to the first grid cell. To do this, select the Table tab in the bottom-left corner, then drag the table and drop it in the grid cell.
5. Move the payments table to the second grid cell. The report layout should look like the one shown in Figure 13-21.

Figure 13-21 Side-by-side subreports in the report design
6. Preview the report. The report should look like the one shown in Figure 13-22.

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

### Task 13: 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.
- Edit the column headings.
- Change the date formats.
- Change the number formats.
- Increase the vertical space between elements.
- Increase the horizontal space between the orders and payments tables.
- Add borders around the tables.
- Increase the space between the table borders and contents.

#### 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. The text increases in size.

6. Choose B to format the data as bold text. The data appears in bold.

#### 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 you need to change them.

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:

    Order Number

3. Repeat the previous steps to change the rest of the column headings to the following text:

    Order Date
    Payment Date
    Check Number
    Amount

The report layout should look like the one shown in Figure 13-23.

Figure 13-23 Edited column headings in the report design
4. Preview the report. The report should look like the one shown in Figure 13-24.

Figure 13-24 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 12:00 AM 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-25.

Figure 13-25 New Style
4. For Custom Style, type:

    Date_data

5. Choose Format DateTime from the list of style properties on the left.
6. Choose the m/d/yy format from the drop-down list. The values in the drop-down list dynamically update with the current date.
7. Choose OK.
The Date_data style is applied to the [ORDERDATE] data element, as shown in Figure 13-26.

Figure 13-26 Date_data style applied to a data element
8. Apply the Date_data style to the payment date data element.

1. Select the data element that displays [PAYMENTDATE], as shown in Figure 13-27.

Figure 13-27 The [PAYMENTDATE] element selected
2. Right-click the selected element, then choose Style->Apply Style->Date_data.

9. Preview the report. The dates have changed from Jun 3, 2005 12:00 AM format to 6/3/05.

#### 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:

    Currency_data

5. Choose Format Number from the list of style properties on the left.
6. Specify the following formatting attributes, as shown in Figure 13-28:

- For Format Number 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-28 Format Number properties

7. Choose OK. The Currency_data style is applied to the [AMOUNT] data element, as indicated by the element's Style property in Property Editor.
8. Preview the report. The numbers appear in the currency format, as shown in Figure 13-29.

Figure 13-29 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:

- You can increase the top or bottom padding or margins of elements.
- You can organize the elements in a grid and adjust the heights of the grid rows.
- You can organize the elements in a grid and use empty rows with specified heights to provide space between elements.

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.
The layout editor shows the borders of individual data elements, grids, tables, and cells, and it can sometimes be difficult to see where an element is placed. If you need a clearer view of the containers and the elements within the containers, use the Outline view to get a tree view of the report design. You can also use the Outline view to select a particular element if it is too difficult to select. For example, selecting the grid rather than the table within the grid can be difficult. To open the Outline view, choose Window->Show View->Outline.
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-30.

Figure 13-30 Inserting a new row
A new row appears above the selected row.
3. Move the [CUSTOMERNAME] data element from its current location to the first cell of the new grid row, as shown in Figure 13-31.

Figure 13-31 Data element moved to the new row

3. Add a new grid row above and below the row that contains the [CUSTOMERNAME] data element, using the procedures that were described earlier.
4. Select the grid, then select the first row in the grid, as shown in Figure 13-32.

Figure 13-32 Selecting the first row
5. In the General properties of Property Editor, set the row's height to 0.2 in, as shown in Figure 13-33.

Figure 13-33 Setting the row height property
6. 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-34.

Figure 13-34 New row heights in the report design
7. Preview the report. There is more space above and below the customer name. The report should look like the one shown in Figure 13-35.

Figure 13-35 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:

- You can increase the left or right padding or margins of elements.
- You can organize the elements in a grid and adjust the widths of the grid columns.
- You can organize the elements in a grid and use empty columns with specified widths to provide space between elements.

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-36.

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

Figure 13-37 Setting a column width
The width of the second column decreases.
5. Preview the report.
There is more space between the orders and payments tables, as shown in Figure 13-38.

Figure 13-38 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.
- Choose all the buttons to add borders around the table, as shown in Figure 13-39.

Figure 13-39 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-40.

Figure 13-40 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-41, and not the data element in the cell.

Figure 13-41 Selecting a cell
The title that appears in Property Editor shows the name of the element that you selected. Verify that it displays the following text:

    Property Editor - Cell

3. Choose the Padding properties in Property Editor, then set Top and Left to 6 points.
Figure 13-42 shows these property settings.

Figure 13-42 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-43.

Figure 13-43 Cell padding in the report design
4. Select the cell next to the cell that you just formatted, and set its Top and Left padding properties to 6 points.
5. Select the two cells in the detail row, and set the Left padding property to 6 points.
6. Select the cells that are in the same positions in the payments table, and apply the same settings that you used for the cells in the orders table.
7. Preview the report. The report should look like the one shown in Figure 13-44.

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