Creating column bindings
As discussed previously, when you drag a data set field from Data Explorer to a table in the layout editor, BIRT Report Designer creates the column binding. The table that contains the data set fields displays the list of column bindings when you select the table and choose the Binding tab on Property Editor. Figure 8-5 shows an example of a table's binding information.
Figure 8-5 Binding information for a selected table
In Figure 8-5, the CUSTOMERNAME, PHONE, and COUNTRY column bindings were generated by BIRT Report Designer when the data set fields, CUSTOMERNAME, PHONE, and COUNTRY were inserted in the table.
When you insert a dynamic text, text, image, or data element from the palette, you must manually create the column binding if you want the element to display dynamic data. If the information to display is static—for example, a specific image stored in a file system, or literal text—then column binding is not applicable.
How to create a column binding
This procedure shows an example of creating a column binding for a data element that was added to the report shown in Figure 8-5.
- Drag a data element from the palette and drop it in the table. Select Data Binding displays all the column bindings defined previously for elements in the table.
- Create a new column binding:
- Select the first empty row and, in Name, specify a unique name for the column binding.
- In Data Type, select a data type appropriate for the data returned by the expression you specify next. If you are not sure what the data type is, use the default type, Any.
- In Expression, specify the expression that indicates the data to return, using one of the following methods:
- Type the expression directly in the Expression field.
If you need help constructing the expression, click in the empty field, then choose the ellipsis button to launch Expression Builder.
Figure 8-6 shows an expression in Expression Builder that combines the values of two data set fields selected from the Customers data set. Choose OK when you finish constructing the expression.
Figure 8-6 Expression Builder showing a column-binding expression
- In Aggregate On, use the default value, N/A. The Aggregate On option applies only to aggregate expressions that perform calculations over a specified set of data rows.
Figure 8-7 Example of a user-defined column binding
- Select the column binding you created by clicking the check box next to the column-binding name, then choose OK. The data element uses the selected column binding. When you preview the report, the data element displays the data defined in the column binding.