Adding data fields for an expression
It is common to use a data field in an expression for a computed column. As mentioned earlier, a computed column only has access to data fields that are used in the BIRT design. Sometimes, however, you need to write an expression that uses a field provided by the data set, but you do not want to display the field values in the report.
For example, if you insert a CustomerName field and a Phone field in a table, then you insert a computed column, the computed column only has access to the CustomerName and Phone fields. You cannot create an expression that combines, for example, values from the AddressLine1, City, State, and PostalCode fields. To create such a computed column, you must first add the data fields to the table, without actually using the fields in the table.
You can use the data fields you add to perform the following actions in Report Studio:
*Filtering data using the Advanced Filter dialog box
*Applying a conditional format
*Representing data graphically in a chart
How to add a data field
1 Right‑click the table handle. Choose Data Fields, as shown in Figure 8‑5.
Figure 8‑5 Adding a data field to a table
Data Fields appears. Figure 8‑6 shows an example of Data Fields displaying the data fields currently used in the table.
Figure 8‑6 Data Fields displaying the fields currently used in the table
2 Choose Add More Fields. Data Set displays all the fields in the data set, as shown in Figure 8‑7.
Figure 8‑7 Data Set displaying all the available fields
3 Select the field to add. To add multiple fields, press Ctrl as you select each field. Choose OK.
4 On Data Fields, choose OK. The selected fields are available to use in any expression.
To remove data fields not used in a BIRT design, deselect each data field. If you are in the process of defining an expression for a computed column, you can choose Add Data Field, in the Calculation dialog box, then follow steps 2 through 4 to add fields.