Editing and deleting column bindings
Be careful when editing or deleting column bindings. More than one element can use a column binding, and a column binding can refer to other column bindings. Earlier in this chapter, you saw examples of how a change to a calculated-data expression cascaded to other expressions. The ease with which you can dynamically update formulas that refer to column bindings also requires that you be aware of those dependencies.
To minimize errors, BIRT allows you to edit the data type, display name, and the expression, but not the name of the column binding. Figure 3‑6 shows Edit Data Binding, which opens when you double-click a data element in the report. The value in Column Binding Name is read-only.
Figure 6-4 Edit Data Binding, showing the definition of a column bindingFigure 6-4 Edit Data Binding, showing the definition of a column binding
Figure 3‑6 Edit Data Binding showing the definition of a column binding
If you could edit the name of the column binding, expressions in other column bindings that refer to that column binding would no longer be valid, unless you also update all expressions to refer to the renamed column binding. For example, as Figure 3‑6 shows, the expression in Sales_Tax refers to a column binding named Order_Total. If you could rename Order_Total, the expression in Sales_Tax, row["Order_Total"] * 0.08, would refer to a column binding that no longer exists.
Deleting a column binding that is used by multiple elements results in errors in the report design. Consider the following scenario:
You drop a data set field, COUNTRY, in a table. BIRT Designer creates a column binding named COUNTRY that refers to the data set field. You create a sort condition to display rows alphabetically by country names. The sort expression uses the COUNTRY column binding. Later, you decide not to display the COUNTRY values in the report. You delete the [COUNTRY] data element from the table. To maintain an accurate list of column bindings used in the table, you also delete the COUNTRY column binding from the table’s Binding page. When you run the report, BIRT displays an error message because the sort expression still refers to the COUNTRY column binding, which no longer exists.
Before you edit or delete a column binding, consider these guidelines:
*A change to a column binding’s expression applies to other column bindings that refer to that column binding.
*A column binding can be used in a variety of expressions, not just by data elements that display field values in the report. For example, expressions used to sort, group, filter, or highlight data also refer to column bindings.
If you delete a column binding, preview the report immediately to make sure you have not introduced any errors. If the report no longer generates, use the Undo functionality to restore the report to its previous state.