Binding Data
The data set or data sets you create return the data that you want to use in a report. Before you can use or display this data in a report, you must first create the necessary data bindings. As the first tutorial demonstrated, to display the data in a report, you simply drag data set fields from Data Explorer to a table in the layout editor. Each time you insert a data set field, BIRT creates a data binding automatically.
This data binding, called a column binding, defines an expression that specifies what data to display. The column binding also defines a name that report elements use to access data. To view the column bindings that BIRT creates automatically for each data set field that you place in a table, select the table, then, in Property Editor, choose the Binding tab. Figure 4‑1 shows an example of column bindings created for each data set field in a table.
How to create a column binding
This procedure shows an example of creating a column binding for a data element.
1
2 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.
3 In Expression, specify the expression that indicates the data to return, using one of the following methods:
o If you need help constructing the expression, choose the expression builder button to launch the expression builder. Figure 4‑2 shows an expression in the 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 4 2 Figure 4‑3 shows an example of a column-binding definition.
Figure 4 3 In the layout editor, the report design displays [Contact_Name] in the location where you inserted the data element, indicating that the data element uses the column binding you defined.
3 Preview the report. The data element displays the data defined in the column binding expression.
(c) Copyright Actuate Corporation 2008 |